<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>C Library Reference &mdash; MCC DAQ HAT Library 1.5.0 documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b76e3c8a" />
      <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />

  
    <link rel="shortcut icon" href="_static/favicon.ico"/>
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="_static/jquery.js?v=5d32c60e"></script>
        <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="_static/documentation_options.js?v=e0a75244"></script>
        <script src="_static/doctools.js?v=888ff710"></script>
        <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Python Library Reference" href="python.html" />
    <link rel="prev" title="Installing and Using the Library" href="install.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="index.html" class="icon icon-home">
            MCC DAQ HAT Library
          </a>
              <div class="version">
                1.5.0
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Hardware Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="hardware.html">Installing the DAQ HAT board</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installing and Using the Library</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">C Library Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#global-functions-and-data">Global functions and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#functions">Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#data-types-and-definitions">Data types and definitions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#hat-ids">HAT IDs</a></li>
<li class="toctree-l4"><a class="reference internal" href="#result-codes">Result Codes</a></li>
<li class="toctree-l4"><a class="reference internal" href="#hatinfo-structure">HatInfo structure</a></li>
<li class="toctree-l4"><a class="reference internal" href="#analog-input-scan-option-flags">Analog Input / Scan Option Flags</a></li>
<li class="toctree-l4"><a class="reference internal" href="#scan-status-flags">Scan Status Flags</a></li>
<li class="toctree-l4"><a class="reference internal" href="#trigger-modes">Trigger Modes</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-118-functions-and-data">MCC 118 functions and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#data-definitions">Data definitions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#device-info">Device Info</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-128-functions-and-data">MCC 128 functions and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">Data definitions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id4">Device Info</a></li>
<li class="toctree-l4"><a class="reference internal" href="#analog-input-modes">Analog Input Modes</a></li>
<li class="toctree-l4"><a class="reference internal" href="#analog-input-ranges">Analog Input Ranges</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-134-functions-and-data">MCC 134 functions and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id5">Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id6">Data definitions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id7">Device Info</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thermocouple-types">Thermocouple Types</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-152-functions-and-data">MCC 152 functions and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id8">Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id9">Data types and definitions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id10">Device Info</a></li>
<li class="toctree-l4"><a class="reference internal" href="#dio-config-items">DIO Config Items</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-172-functions-and-data">MCC 172 functions and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id11">Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id12">Data definitions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id13">Device Info</a></li>
<li class="toctree-l4"><a class="reference internal" href="#source-types">Source Types</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Library Reference</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">MCC DAQ HAT Library</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">C Library Reference</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/c.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="c-library-reference">
<h1>C Library Reference<a class="headerlink" href="#c-library-reference" title="Link to this heading"></a></h1>
<p>The C library is organized as a global function for listing the DAQ HAT boards attached
to your system, and board-specific functions to provide full functionality for each
type of board.  The library may be used with C and C++.</p>
<section id="global-functions-and-data">
<h2>Global functions and data<a class="headerlink" href="#global-functions-and-data" title="Link to this heading"></a></h2>
<section id="functions">
<h3>Functions<a class="headerlink" href="#functions" title="Link to this heading"></a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Function</p></td>
<td><p>Description</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.hat_list" title="hat_list"><code class="xref c c-func docutils literal notranslate"><span class="pre">hat_list()</span></code></a></p></td>
<td><p>Return a list of detected DAQ HAT boards.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.hat_error_message" title="hat_error_message"><code class="xref c c-func docutils literal notranslate"><span class="pre">hat_error_message()</span></code></a></p></td>
<td><p>Return a text description for a DAQ HAT result.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.hat_wait_for_interrupt" title="hat_wait_for_interrupt"><code class="xref c c-func docutils literal notranslate"><span class="pre">hat_wait_for_interrupt()</span></code></a></p></td>
<td><p>Wait for an interrupt to occur.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.hat_interrupt_state" title="hat_interrupt_state"><code class="xref c c-func docutils literal notranslate"><span class="pre">hat_interrupt_state()</span></code></a></p></td>
<td><p>Read the current interrupt status.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.hat_interrupt_callback_enable" title="hat_interrupt_callback_enable"><code class="xref c c-func docutils literal notranslate"><span class="pre">hat_interrupt_callback_enable()</span></code></a></p></td>
<td><p>Enable an interrupt callback function.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.hat_interrupt_callback_disable" title="hat_interrupt_callback_disable"><code class="xref c c-func docutils literal notranslate"><span class="pre">hat_interrupt_callback_disable()</span></code></a></p></td>
<td><p>Disable interrupt callback function.</p></td>
</tr>
</tbody>
</table>
<dl class="c function">
<dt class="sig sig-object c" id="c.hat_list">
<span class="target" id="daqhats_8h_1ab23b9501c36d525c9a9a642c7885bd06"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">hat_list</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n"><span class="pre">filter_id</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.HatInfo" title="HatInfo"><span class="n"><span class="pre">HatInfo</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">list</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.hat_list" title="Link to this definition"></a><br /></dt>
<dd><p>Return a list of detected DAQ HAT boards.</p>
<p>It creates the list from the DAQ HAT EEPROM files that are currently on the system. In the case of a single DAQ HAT at address 0 this information is automatically provided by the OS. However, when you have a stack of multiple boards you must extract the EEPROM images using the <strong>daqhats_read_eeproms</strong> tool.</p>
<p>Example usage: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">int</span> <span class="n">count</span> <span class="o">=</span> <span class="n">hat_list</span><span class="p">(</span><span class="n">HAT_ID_ANY</span><span class="p">,</span> <span class="n">NULL</span><span class="p">);</span>

<span class="k">if</span> <span class="p">(</span><span class="n">count</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">struct</span> <span class="n">HatInfo</span><span class="o">*</span> <span class="nb">list</span> <span class="o">=</span> <span class="p">(</span><span class="n">struct</span> <span class="n">HatInfo</span><span class="o">*</span><span class="p">)</span><span class="n">malloc</span><span class="p">(</span><span class="n">count</span> <span class="o">*</span> 
        <span class="n">sizeof</span><span class="p">(</span><span class="n">struct</span> <span class="n">HatInfo</span><span class="p">));</span>
    <span class="n">hat_list</span><span class="p">(</span><span class="n">HAT_ID_ANY</span><span class="p">,</span> <span class="nb">list</span><span class="p">);</span>

    <span class="o">//</span> <span class="n">perform</span> <span class="n">actions</span> <span class="k">with</span> <span class="nb">list</span>

    <span class="n">free</span><span class="p">(</span><span class="nb">list</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
</div>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filter_id</strong> – An optional <a class="reference internal" href="#daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8"><span class="std std-ref">ID</span></a> filter to only return boards with a specific ID. Use <a class="reference internal" href="#daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8a52d705896d388224ec9cac80d44ccc3c"><span class="std std-ref">HAT_ID_ANY</span></a> to return all boards. </p></li>
<li><p><strong>list</strong> – A pointer to a user-allocated array of struct <a class="reference internal" href="#structHatInfo"><span class="std std-ref">HatInfo</span></a>. The function will fill the structures with information about the detected boards. You may have an array of the maximum number of boards (<a class="reference internal" href="#daqhats_8h_1af19d06df1dc47bdbc0206b8fc7ad7c4d"><span class="std std-ref">MAX_NUMBER_HATS</span></a>) or call this function while passing NULL for list, which will return the count of boards found, then allocate the correct amount of memory and call this function again with a valid pointer. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The number of boards found. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.hat_error_message">
<span class="target" id="daqhats_8h_1ae86df565e06752ec3fbcc1fc59ac7afc"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">hat_error_message</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">result</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.hat_error_message" title="Link to this definition"></a><br /></dt>
<dd><p>Return a text description for a DAQ HAT result code.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>result</strong> – The <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a> returned from a DAQ HAT function </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The error message. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.hat_wait_for_interrupt">
<span class="target" id="daqhats_8h_1a310c568b97d4e34e9534858b5b85602c"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">hat_wait_for_interrupt</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">timeout</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.hat_wait_for_interrupt" title="Link to this definition"></a><br /></dt>
<dd><p>Wait for an interrupt to occur.</p>
<p>It waits for the interrupt signal to become active, with a timeout parameter.</p>
<p>This function only applies when using devices that can generate an interrupt:<ul class="simple">
<li><p>MCC 152</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timeout</strong> – Wait timeout in milliseconds. -1 to wait forever, 0 to return immediately. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4ad02c8491b0eab6eab286a00466993805"><span class="std std-ref">RESULT_TIMEOUT</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a>, or <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4aee38f3e4015c3c821852c2c14304770a"><span class="std std-ref">RESULT_UNDEFINED</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.hat_interrupt_state">
<span class="target" id="daqhats_8h_1a275955f80b2e8e67a896ac61bbca54a6"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">hat_interrupt_state</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.hat_interrupt_state" title="Link to this definition"></a><br /></dt>
<dd><p>Read the current interrupt status.</p>
<p>It returns the status of the interrupt signal. This signal can be shared by multiple boards so the status of each board that may generate must be read and the interrupt source(s) cleared before the interrupt will become inactive.</p>
<p>This function only applies when using devices that can generate an interrupt:<ul class="simple">
<li><p>MCC 152</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>1 if interrupt is active, 0 if inactive. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.hat_interrupt_callback_enable">
<span class="target" id="daqhats_8h_1a38121826f94ae6dd764c28a08f9c5969"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">hat_interrupt_callback_enable</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">(</span></span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">function</span></span><span class="p"><span class="pre">)</span></span><span class="p"><span class="pre">(</span></span><span class="kt"><span class="pre">void</span></span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">)</span></span>, <span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">user_data</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.hat_interrupt_callback_enable" title="Link to this definition"></a><br /></dt>
<dd><p>Enable an interrupt callback function.</p>
<p>Set a function that will be called when a DAQ HAT interrupt occurs. The function must have a void return type and void * argument, such as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">void</span> <span class="n">function</span><span class="p">(</span><span class="n">void</span><span class="o">*</span> <span class="n">user_data</span><span class="p">)</span>
</pre></div>
</div>
 The function will be called when the DAQ HAT interrupt signal becomes active, and cannot be called again until the interrupt signal becomes inactive. Active sources become inactive when manually cleared (such as reading the digital I/O inputs or clearing the interrupt enable.) If not latched, an active source also becomes inactive when the value returns to the original value (the value at the source before the interrupt was generated.)</p>
<p>The user_data argument can be used for passing a reference to anything needed by the callback function. It will be passed to the callback function when the interrupt occurs. Set it to NULL if not needed.</p>
<p>There may only be one callback function at a time; if you call this when a function is already set as the callback function then it will be replaced with the new function and the old function will no longer be called if an interrupt occurs.</p>
<p>The callback function may be disabled with <a class="reference internal" href="#daqhats_8h_1a8e10d63dead5be6d82200786dbc30b33"><span class="std std-ref">hat_interrupt_callback_disable()</span></a>.</p>
<p>This function only applies when using devices that can generate an interrupt:<ul class="simple">
<li><p>MCC 152</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>function</strong> – The callback function. </p></li>
<li><p><strong>user_data</strong> – The data to pass to the callback function. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> or <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4aee38f3e4015c3c821852c2c14304770a"><span class="std std-ref">RESULT_UNDEFINED</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.hat_interrupt_callback_disable">
<span class="target" id="daqhats_8h_1a8e10d63dead5be6d82200786dbc30b33"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">hat_interrupt_callback_disable</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.hat_interrupt_callback_disable" title="Link to this definition"></a><br /></dt>
<dd><p>Disable interrupt callbacks.</p>
<p>Removes any callback function from the interrupt handler.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> or <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4aee38f3e4015c3c821852c2c14304770a"><span class="std std-ref">RESULT_UNDEFINED</span></a>. </p>
</dd>
</dl>
</dd></dl>

</section>
<section id="data-types-and-definitions">
<h3>Data types and definitions<a class="headerlink" href="#data-types-and-definitions" title="Link to this heading"></a></h3>
<dl class="c macro">
<dt class="sig sig-object c" id="c.MAX_NUMBER_HATS">
<span class="target" id="daqhats_8h_1af19d06df1dc47bdbc0206b8fc7ad7c4d"></span><span class="sig-name descname"><span class="n"><span class="pre">MAX_NUMBER_HATS</span></span></span> <span class="pre">8</span><a class="headerlink" href="#c.MAX_NUMBER_HATS" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum number of DAQ HATs that may be connected. </p>
</dd></dl>

<section id="hat-ids">
<h4>HAT IDs<a class="headerlink" href="#hat-ids" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.HatIDs">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HatIDs</span></span></span><a class="headerlink" href="#c.HatIDs" title="Link to this definition"></a><br /></dt>
<dd><p>Known DAQ HAT IDs. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_ANY">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8a52d705896d388224ec9cac80d44ccc3c"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_ANY</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_ANY" title="Link to this definition"></a><br /></dt>
<dd><p>Match any DAQ HAT ID in <a class="reference internal" href="#daqhats_8h_1ab23b9501c36d525c9a9a642c7885bd06"><span class="std std-ref">hat_list()</span></a>. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_MCC_118">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8a8f4ccb8e4e08760f13f50109654615e4"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_MCC_118</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_MCC_118" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 118 ID. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_MCC_118_BOOTLOADER">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8a37746a1d99f0112b16de95479eef7e19"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_MCC_118_BOOTLOADER</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_MCC_118_BOOTLOADER" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 118 in firmware update mode ID. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_MCC_128">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8afc450d32228a6ed220a9a7ce9e1286e6"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_MCC_128</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_MCC_128" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 128 ID. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_MCC_134">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8adededfba1b3d304ee4b2cdaba5e6ba1c"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_MCC_134</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_MCC_134" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 134 ID. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_MCC_152">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8a5c9a7ce837356d2960a0eb274a9e647f"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_MCC_152</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_MCC_152" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 152 ID. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.HatIDs.HAT_ID_MCC_172">
<span class="target" id="daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8a03eef89b2327c4aba10b460edc7eb619"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HAT_ID_MCC_172</span></span></span><a class="headerlink" href="#c.HatIDs.HAT_ID_MCC_172" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 172 ID. </p>
</dd></dl>

</dd></dl>

</section>
<section id="result-codes">
<h4>Result Codes<a class="headerlink" href="#result-codes" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.ResultCode">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">ResultCode</span></span></span><a class="headerlink" href="#c.ResultCode" title="Link to this definition"></a><br /></dt>
<dd><p>Return values from the library functions. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_SUCCESS">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_SUCCESS</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_SUCCESS" title="Link to this definition"></a><br /></dt>
<dd><p>Success, no errors. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_BAD_PARAMETER">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_BAD_PARAMETER</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_BAD_PARAMETER" title="Link to this definition"></a><br /></dt>
<dd><p>A parameter passed to the function was incorrect. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_BUSY">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_BUSY</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_BUSY" title="Link to this definition"></a><br /></dt>
<dd><p>The device is busy. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_TIMEOUT">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4ad02c8491b0eab6eab286a00466993805"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_TIMEOUT</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_TIMEOUT" title="Link to this definition"></a><br /></dt>
<dd><p>There was a timeout accessing a resource. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_LOCK_TIMEOUT">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a54f89f36abc33dd9988bab6f2593d09e"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_LOCK_TIMEOUT</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_LOCK_TIMEOUT" title="Link to this definition"></a><br /></dt>
<dd><p>There was a timeout while obtaining a resource lock. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_INVALID_DEVICE">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a2e885005d4bd08f56d98408cc346d7e2"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_INVALID_DEVICE</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_INVALID_DEVICE" title="Link to this definition"></a><br /></dt>
<dd><p>The device at the specified address is not the correct type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_RESOURCE_UNAVAIL">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_RESOURCE_UNAVAIL</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_RESOURCE_UNAVAIL" title="Link to this definition"></a><br /></dt>
<dd><p>A needed resource was not available. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_COMMS_FAILURE">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a4f78740ca0109747cce304ada3b20241"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_COMMS_FAILURE</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_COMMS_FAILURE" title="Link to this definition"></a><br /></dt>
<dd><p>Could not communicate with the device. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.ResultCode.RESULT_UNDEFINED">
<span class="target" id="daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4aee38f3e4015c3c821852c2c14304770a"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">RESULT_UNDEFINED</span></span></span><a class="headerlink" href="#c.ResultCode.RESULT_UNDEFINED" title="Link to this definition"></a><br /></dt>
<dd><p>Some other error occurred. </p>
</dd></dl>

</dd></dl>

</section>
<section id="hatinfo-structure">
<h4>HatInfo structure<a class="headerlink" href="#hatinfo-structure" title="Link to this heading"></a></h4>
<dl class="c struct">
<dt class="sig sig-object c" id="c.HatInfo">
<span class="target" id="structHatInfo"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">HatInfo</span></span></span><a class="headerlink" href="#c.HatInfo" title="Link to this definition"></a><br /></dt>
<dd><p>Contains information about a specific board. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt class="sig sig-object c" id="c.HatInfo.address">
<span class="target" id="structHatInfo_1a87bec040f5902f07afa5a6c1fc657ba7"></span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">address</span></span></span><a class="headerlink" href="#c.HatInfo.address" title="Link to this definition"></a><br /></dt>
<dd><p>The board address. </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.HatInfo.id">
<span class="target" id="structHatInfo_1ab192616ceed94f52e15151cf49e19732"></span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">id</span></span></span><a class="headerlink" href="#c.HatInfo.id" title="Link to this definition"></a><br /></dt>
<dd><p>The product ID, one of <a class="reference internal" href="#daqhats_8h_1a30cd29e26738a6f6d11746f3ccfa06e8"><span class="std std-ref">HatIDs</span></a>. </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.HatInfo.version">
<span class="target" id="structHatInfo_1a757ca79387cf8113ed440d03f76f103a"></span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">version</span></span></span><a class="headerlink" href="#c.HatInfo.version" title="Link to this definition"></a><br /></dt>
<dd><p>The hardware version. </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.HatInfo.product_name">
<span class="target" id="structHatInfo_1a8b6a099796d7eb2d4a298537d4aaf333"></span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">product_name</span></span></span><span class="p"><span class="pre">[</span></span><span class="m"><span class="pre">256</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#c.HatInfo.product_name" title="Link to this definition"></a><br /></dt>
<dd><p>The product name. </p>
</dd></dl>

</div>
</dd></dl>

</section>
<section id="analog-input-scan-option-flags">
<h4>Analog Input / Scan Option Flags<a class="headerlink" href="#analog-input-scan-option-flags" title="Link to this heading"></a></h4>
<p>See individual function documentation for detailed usage information.</p>
<dl class="c macro">
<dt class="sig sig-object c" id="c.OPTS_DEFAULT">
<span class="target" id="daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"></span><span class="sig-name descname"><span class="n"><span class="pre">OPTS_DEFAULT</span></span></span> <span class="pre">(0x0000)</span><a class="headerlink" href="#c.OPTS_DEFAULT" title="Link to this definition"></a><br /></dt>
<dd><p>Default behavior. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.OPTS_NOSCALEDATA">
<span class="target" id="daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"></span><span class="sig-name descname"><span class="n"><span class="pre">OPTS_NOSCALEDATA</span></span></span> <span class="pre">(0x0001)</span><a class="headerlink" href="#c.OPTS_NOSCALEDATA" title="Link to this definition"></a><br /></dt>
<dd><p>Read / write unscaled data. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.OPTS_NOCALIBRATEDATA">
<span class="target" id="daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"></span><span class="sig-name descname"><span class="n"><span class="pre">OPTS_NOCALIBRATEDATA</span></span></span> <span class="pre">(0x0002)</span><a class="headerlink" href="#c.OPTS_NOCALIBRATEDATA" title="Link to this definition"></a><br /></dt>
<dd><p>Read / write uncalibrated data. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.OPTS_EXTCLOCK">
<span class="target" id="daqhats_8h_1a385c1e54c5caa4ddaab2bbed18a974a8"></span><span class="sig-name descname"><span class="n"><span class="pre">OPTS_EXTCLOCK</span></span></span> <span class="pre">(0x0004)</span><a class="headerlink" href="#c.OPTS_EXTCLOCK" title="Link to this definition"></a><br /></dt>
<dd><p>Use an external clock source. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.OPTS_EXTTRIGGER">
<span class="target" id="daqhats_8h_1aa2c6cc0f41865f0885ab83c6aa446dc1"></span><span class="sig-name descname"><span class="n"><span class="pre">OPTS_EXTTRIGGER</span></span></span> <span class="pre">(0x0008)</span><a class="headerlink" href="#c.OPTS_EXTTRIGGER" title="Link to this definition"></a><br /></dt>
<dd><p>Use an external trigger source. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.OPTS_CONTINUOUS">
<span class="target" id="daqhats_8h_1af34e1d3813b5909d7b8bf3012a2d829a"></span><span class="sig-name descname"><span class="n"><span class="pre">OPTS_CONTINUOUS</span></span></span> <span class="pre">(0x0010)</span><a class="headerlink" href="#c.OPTS_CONTINUOUS" title="Link to this definition"></a><br /></dt>
<dd><p>Run until explicitly stopped. </p>
</dd></dl>

</section>
<section id="scan-status-flags">
<h4>Scan Status Flags<a class="headerlink" href="#scan-status-flags" title="Link to this heading"></a></h4>
<dl class="c macro">
<dt class="sig sig-object c" id="c.STATUS_HW_OVERRUN">
<span class="target" id="daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"></span><span class="sig-name descname"><span class="n"><span class="pre">STATUS_HW_OVERRUN</span></span></span> <span class="pre">(0x0001)</span><a class="headerlink" href="#c.STATUS_HW_OVERRUN" title="Link to this definition"></a><br /></dt>
<dd><p>A hardware overrun occurred. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.STATUS_BUFFER_OVERRUN">
<span class="target" id="daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"></span><span class="sig-name descname"><span class="n"><span class="pre">STATUS_BUFFER_OVERRUN</span></span></span> <span class="pre">(0x0002)</span><a class="headerlink" href="#c.STATUS_BUFFER_OVERRUN" title="Link to this definition"></a><br /></dt>
<dd><p>A scan buffer overrun occurred. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.STATUS_TRIGGERED">
<span class="target" id="daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"></span><span class="sig-name descname"><span class="n"><span class="pre">STATUS_TRIGGERED</span></span></span> <span class="pre">(0x0004)</span><a class="headerlink" href="#c.STATUS_TRIGGERED" title="Link to this definition"></a><br /></dt>
<dd><p>The trigger event occurred. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.STATUS_RUNNING">
<span class="target" id="daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"></span><span class="sig-name descname"><span class="n"><span class="pre">STATUS_RUNNING</span></span></span> <span class="pre">(0x0008)</span><a class="headerlink" href="#c.STATUS_RUNNING" title="Link to this definition"></a><br /></dt>
<dd><p>The scan is running (actively acquiring data.) </p>
</dd></dl>

</section>
<section id="trigger-modes">
<h4>Trigger Modes<a class="headerlink" href="#trigger-modes" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.TriggerMode">
<span class="target" id="daqhats_8h_1aa534ed76b07c3983382a53e00e53e94a"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TriggerMode</span></span></span><a class="headerlink" href="#c.TriggerMode" title="Link to this definition"></a><br /></dt>
<dd><p>Scan trigger input modes. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TriggerMode.TRIG_RISING_EDGE">
<span class="target" id="daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aa1df95eae49cc686aa6b9f91fa13c220b"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TRIG_RISING_EDGE</span></span></span><a class="headerlink" href="#c.TriggerMode.TRIG_RISING_EDGE" title="Link to this definition"></a><br /></dt>
<dd><p>Start the scan on a rising edge of TRIG. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TriggerMode.TRIG_FALLING_EDGE">
<span class="target" id="daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aaa008e9300e76a51f4c60fd9bf2ae5546"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TRIG_FALLING_EDGE</span></span></span><a class="headerlink" href="#c.TriggerMode.TRIG_FALLING_EDGE" title="Link to this definition"></a><br /></dt>
<dd><p>Start the scan on a falling edge of TRIG. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TriggerMode.TRIG_ACTIVE_HIGH">
<span class="target" id="daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aa3f701a26940df0c263d230b753f61274"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TRIG_ACTIVE_HIGH</span></span></span><a class="headerlink" href="#c.TriggerMode.TRIG_ACTIVE_HIGH" title="Link to this definition"></a><br /></dt>
<dd><p>Start the scan any time TRIG is high. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TriggerMode.TRIG_ACTIVE_LOW">
<span class="target" id="daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aa95176a26d99fad97d400764990a71c0b"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TRIG_ACTIVE_LOW</span></span></span><a class="headerlink" href="#c.TriggerMode.TRIG_ACTIVE_LOW" title="Link to this definition"></a><br /></dt>
<dd><p>Start the scan any time TRIG is low. </p>
</dd></dl>

</dd></dl>

</section>
</section>
</section>
<section id="mcc-118-functions-and-data">
<h2>MCC 118 functions and data<a class="headerlink" href="#mcc-118-functions-and-data" title="Link to this heading"></a></h2>
<section id="id1">
<h3>Functions<a class="headerlink" href="#id1" title="Link to this heading"></a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Function</p></td>
<td><p>Description</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_open" title="mcc118_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_open()</span></code></a></p></td>
<td><p>Open an MCC 118 for use.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_is_open" title="mcc118_is_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_is_open()</span></code></a></p></td>
<td><p>Check if an MCC 118 is open.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_close" title="mcc118_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_close()</span></code></a></p></td>
<td><p>Close an MCC 118.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_info" title="mcc118_info"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_info()</span></code></a></p></td>
<td><p>Return information about this device type.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_blink_led" title="mcc118_blink_led"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_blink_led()</span></code></a></p></td>
<td><p>Blink the MCC 118 LED.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_firmware_version" title="mcc118_firmware_version"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_firmware_version()</span></code></a></p></td>
<td><p>Get the firmware version.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_serial" title="mcc118_serial"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_serial()</span></code></a></p></td>
<td><p>Read the serial number.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_calibration_date" title="mcc118_calibration_date"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_calibration_date()</span></code></a></p></td>
<td><p>Read the calibration date.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_calibration_coefficient_read" title="mcc118_calibration_coefficient_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_calibration_coefficient_read()</span></code></a></p></td>
<td><p>Read the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_calibration_coefficient_write" title="mcc118_calibration_coefficient_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_calibration_coefficient_write()</span></code></a></p></td>
<td><p>Write the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_a_in_read" title="mcc118_a_in_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_read()</span></code></a></p></td>
<td><p>Read an analog input value.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_trigger_mode" title="mcc118_trigger_mode"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_trigger_mode()</span></code></a></p></td>
<td><p>Set the external trigger input mode.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_actual_rate" title="mcc118_a_in_scan_actual_rate"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_actual_rate()</span></code></a></p></td>
<td><p>Read the actual sample rate for a set of scan parameters.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_start" title="mcc118_a_in_scan_start"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_start()</span></code></a></p></td>
<td><p>Start a hardware-paced analog input scan.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_buffer_size" title="mcc118_a_in_scan_buffer_size"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_buffer_size()</span></code></a></p></td>
<td><p>Read the size of the internal scan data buffer.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_status" title="mcc118_a_in_scan_status"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_status()</span></code></a></p></td>
<td><p>Read the scan status.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_read" title="mcc118_a_in_scan_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_read()</span></code></a></p></td>
<td><p>Read scan data and status.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_channel_count" title="mcc118_a_in_scan_channel_count"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_channel_count()</span></code></a></p></td>
<td><p>Get the number of channels in the current scan.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_stop" title="mcc118_a_in_scan_stop"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_stop()</span></code></a></p></td>
<td><p>Stop the scan.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc118_a_in_scan_cleanup" title="mcc118_a_in_scan_cleanup"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc118_a_in_scan_cleanup()</span></code></a></p></td>
<td><p>Free scan resources.</p></td>
</tr>
</tbody>
</table>
<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_open">
<span class="target" id="mcc118_8h_1a362f81b0b71d81f7ee1379daa133cac5"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_open" title="Link to this definition"></a><br /></dt>
<dd><p>Open a connection to the MCC 118 device at the specified address. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_close">
<span class="target" id="mcc118_8h_1a0b597685173dc113d85f78fe80a8120b"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_close</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_close" title="Link to this definition"></a><br /></dt>
<dd><p>Close a connection to an MCC 118 device and free allocated resources. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_is_open">
<span class="target" id="mcc118_8h_1a3e051e655911d8227fdeb5f540336622"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_is_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_is_open" title="Link to this definition"></a><br /></dt>
<dd><p>Check if an MCC 118 is open. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>1 if open, 0 if not open. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_info">
<span class="target" id="mcc118_8h_1aff29703ce9501f45f8b5d6e650e63d3f"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.MCC118DeviceInfo" title="MCC118DeviceInfo"><span class="n"><span class="pre">MCC118DeviceInfo</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_info</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_info" title="Link to this definition"></a><br /></dt>
<dd><p>Return constant device information for all MCC 118s. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Pointer to struct <a class="reference internal" href="#structMCC118DeviceInfo"><span class="std std-ref">MCC118DeviceInfo</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_blink_led">
<span class="target" id="mcc118_8h_1a199973ec117aa99fd4ef6e8a004a2476"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_blink_led</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">count</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_blink_led" title="Link to this definition"></a><br /></dt>
<dd><p>Blink the LED on the MCC 118. </p>
<p>Passing 0 for count will result in the LED blinking continuously until the board is reset or <a class="reference internal" href="#mcc118_8h_1a199973ec117aa99fd4ef6e8a004a2476"><span class="std std-ref">mcc118_blink_led()</span></a> is called again with a non-zero value for count.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
<li><p><strong>count</strong> – The number of times to blink (0 - 255). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_firmware_version">
<span class="target" id="mcc118_8h_1a9ab8c7d2d23848158879e3fb6001e475"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_firmware_version</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">version</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">boot_version</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_firmware_version" title="Link to this definition"></a><br /></dt>
<dd><p>Return the board firmware and bootloader versions. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>version</strong> – Receives the firmware version. The version will be in BCD hexadecimal with the high byte as the major version and low byte as minor, i.e. 0x0103 is version 1.03. </p></li>
<li><p><strong>boot_version</strong> – Receives the bootloader version. The version will be in BCD hexadecimal as above. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_serial">
<span class="target" id="mcc118_8h_1a5fa34219e9193e9e2c6e4f7e3377c0fb"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_serial</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_serial" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 118 serial number. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the serial number as a string. The buffer must be at least 9 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_calibration_date">
<span class="target" id="mcc118_8h_1adcdbc31afb9bc75cb25b43b8e58f30c6"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_calibration_date</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_calibration_date" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 118 calibration date. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the date as a string (format “YYYY-MM-DD”). The buffer must be at least 11 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_calibration_coefficient_read">
<span class="target" id="mcc118_8h_1a5fe0ea8151d227e3577ea3ce2cb70868"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_calibration_coefficient_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_calibration_coefficient_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 118 calibration coefficients for a single channel. </p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 7). </p></li>
<li><p><strong>slope</strong> – Receives the slope. </p></li>
<li><p><strong>offset</strong> – Receives the offset. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_calibration_coefficient_write">
<span class="target" id="mcc118_8h_1a305cd3c6eef75521f7807a89927c86d9"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_calibration_coefficient_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_calibration_coefficient_write" title="Link to this definition"></a><br /></dt>
<dd><p>Temporarily write the MCC 118 calibration coefficients for a single channel. </p>
<p>The user can apply their own calibration coefficients by writing to these values. The values will reset to the factory values from the EEPROM whenever <a class="reference internal" href="#mcc118_8h_1a362f81b0b71d81f7ee1379daa133cac5"><span class="std std-ref">mcc118_open()</span></a> is called. This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 7). </p></li>
<li><p><strong>slope</strong> – The new slope value. </p></li>
<li><p><strong>offset</strong> – The new offset value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_read">
<span class="target" id="mcc118_8h_1a2f1b2738ed0f5d9ceca081f6c6deb2e6"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_read" title="Link to this definition"></a><br /></dt>
<dd><p>Perform a single reading of an analog input channel and return the value. </p>
<p>The valid options are:<ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a>: Return ADC code (a value between 0 and 4095) rather than voltage.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a>: Return data without the calibration factors applied.</p></li>
</ul>
</p>
<p>The options parameter is set to 0 or <a class="reference internal" href="#daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"><span class="std std-ref">OPTS_DEFAULT</span></a> for default operation, which is scaled and calibrated data.</p>
<p>Multiple options may be specified by ORing the flags. For instance, specifying <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> | <a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a> will return the value read from the ADC without calibration or converting to voltage.</p>
<p>The function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if called while a scan is running.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number, 0 - 7. </p></li>
<li><p><strong>options</strong> – Options bitmask. </p></li>
<li><p><strong>value</strong> – Receives the analog input value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_trigger_mode">
<span class="target" id="mcc118_8h_1a943125e28d900d64542d7957081a3f64"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_trigger_mode</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">mode</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_trigger_mode" title="Link to this definition"></a><br /></dt>
<dd><p>Set the trigger input mode. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>mode</strong> – One of the <a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94a"><span class="std std-ref">trigger mode</span></a> values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_actual_rate">
<span class="target" id="mcc118_8h_1a86fe5bed532f934cf55f6a2b17e803c2"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_actual_rate</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel_count</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">sample_rate_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">actual_sample_rate_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_actual_rate" title="Link to this definition"></a><br /></dt>
<dd><p>Read the actual sample rate per channel for a requested sample rate. </p>
<p>The internal scan clock is generated from a 16 MHz clock source so only discrete frequency steps can be achieved. This function will return the actual rate for a requested channel count and rate. This function does not perform any actions with a board, it simply calculates the rate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>channel_count</strong> – The number of channels in the scan. </p></li>
<li><p><strong>sample_rate_per_channel</strong> – The desired sampling rate in samples per second per channel, max 100,000. </p></li>
<li><p><strong>actual_sample_rate_per_channel</strong> – The actual sample rate that would occur when requesting this rate on an MCC 118, or 0 if there is an error. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a> if the scan parameters are not achievable on an MCC 118. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_start">
<span class="target" id="mcc118_8h_1a7bb6778d908b3513e7e64a1932bf7d38"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_start</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel_mask</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">samples_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">sample_rate_per_channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_start" title="Link to this definition"></a><br /></dt>
<dd><p>Start a hardware-paced analog input scan. </p>
<p>The scan runs as a separate thread from the user’s code. The function will allocate a scan buffer and read data from the device into that buffer. The user reads the data from this buffer and the scan status using the <a class="reference internal" href="#mcc118_8h_1a1056c2b90b530ce6d0729d8ddb760662"><span class="std std-ref">mcc118_a_in_scan_read()</span></a> function. <a class="reference internal" href="#mcc118_8h_1a361841e611dfe77ad25a49f102f3bbcd"><span class="std std-ref">mcc118_a_in_scan_stop()</span></a> is used to stop a continuous scan, or to stop a finite scan before it completes. The user must call <a class="reference internal" href="#mcc118_8h_1ab11473109120c4734e43b340712972f3"><span class="std std-ref">mcc118_a_in_scan_cleanup()</span></a> after the scan has finished and all desired data has been read; this frees all resources from the scan and allows additional scans to be performed.</p>
<p>The scan state has defined terminology:<ul class="simple">
<li><p><strong>Active:</strong> <a class="reference internal" href="#mcc118_8h_1a7bb6778d908b3513e7e64a1932bf7d38"><span class="std std-ref">mcc118_a_in_scan_start()</span></a> has been called and the device may be acquiring data or finished with the acquisition. The scan has not been cleaned up by calling <a class="reference internal" href="#mcc118_8h_1ab11473109120c4734e43b340712972f3"><span class="std std-ref">mcc118_a_in_scan_cleanup()</span></a>, so another scan may not be started.</p></li>
<li><p><strong>Running:</strong> The scan is active and the device is still acquiring data. Certain functions like <a class="reference internal" href="#mcc118_8h_1a2f1b2738ed0f5d9ceca081f6c6deb2e6"><span class="std std-ref">mcc118_a_in_read()</span></a> will return an error because the device is busy.</p></li>
</ul>
</p>
<p>The valid options are:<ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a>: Returns ADC code (a value between 0 and 4095) rather than voltage.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a>: Return data without the calibration factors applied.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a385c1e54c5caa4ddaab2bbed18a974a8"><span class="std std-ref">OPTS_EXTCLOCK</span></a>: Use an external 3.3V or 5V logic signal at the CLK input as the scan clock. Multiple devices can be synchronized by connecting the CLK pins together and using this option on all but one device so they will be clocked by the single device using its internal clock. <strong>sample_rate_per_channel</strong> is only used for buffer sizing.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1aa2c6cc0f41865f0885ab83c6aa446dc1"><span class="std std-ref">OPTS_EXTTRIGGER</span></a>: Hold off the scan (after calling <a class="reference internal" href="#mcc118_8h_1a7bb6778d908b3513e7e64a1932bf7d38"><span class="std std-ref">mcc118_a_in_scan_start()</span></a>) until the trigger condition is met. The trigger is a 3.3V or 5V logic signal applied to the TRIG pin.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af34e1d3813b5909d7b8bf3012a2d829a"><span class="std std-ref">OPTS_CONTINUOUS</span></a>: Scans continuously until stopped by the user by calling <a class="reference internal" href="#mcc118_8h_1a361841e611dfe77ad25a49f102f3bbcd"><span class="std std-ref">mcc118_a_in_scan_stop()</span></a> and writes data to a circular buffer. The data must be read before being overwritten to avoid a buffer overrun error. <strong>samples_per_channel</strong> is only used for buffer sizing.</p></li>
</ul>
</p>
<p>The options parameter is set to 0 or <a class="reference internal" href="#daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"><span class="std std-ref">OPTS_DEFAULT</span></a> for default operation, which is scaled and calibrated data, internal scan clock, no trigger, and finite operation.</p>
<p>Multiple options may be specified by ORing the flags. For instance, specifying <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> | <a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a> will return the values read from the ADC without calibration or converting to voltage.</p>
<p>The buffer size will be allocated as follows:</p>
<p><strong>Finite</strong> mode: Total number of samples in the scan</p>
<p><strong>Continuous</strong> mode (buffer size is per channel): Either <strong>samples_per_channel</strong> or the value in the following table, whichever is greater</p>
<p><table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Sample Rate   </p></th>
<th class="head"><p>Buffer Size (per channel)    </p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Not specified   </p></td>
<td><p>10 kS    </p></td>
</tr>
<tr class="row-odd"><td><p>0-100 S/s   </p></td>
<td><p>1 kS    </p></td>
</tr>
<tr class="row-even"><td><p>100-10k S/s   </p></td>
<td><p>10 kS    </p></td>
</tr>
<tr class="row-odd"><td><p>10k-100k S/s   </p></td>
<td><p>100 kS   </p></td>
</tr>
</tbody>
</table>
</p>
<p>Specifying a very large value for <strong>samples_per_channel</strong> could use too much of the Raspberry Pi memory. If the memory allocation fails, the function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a>. The allocation could succeed, but the lack of free memory could cause other problems in the Raspberry Pi. If you need to acquire a high number of samples then it is better to run the scan in continuous mode and stop it when you have acquired the desired amount of data. If a scan is already active this function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel_mask</strong> – A bit mask of the channels to be scanned. Set each bit to enable the associated channel (0x01 - 0xFF.) </p></li>
<li><p><strong>samples_per_channel</strong> – The number of samples to acquire for each channel in the scan (finite mode,) or can be used to set a larger scan buffer size than the default value (continuous mode.) </p></li>
<li><p><strong>sample_rate_per_channel</strong> – The sampling rate in samples per second per channel, max 100,000. When using an external sample clock set this value to the maximum expected rate of the clock. </p></li>
<li><p><strong>options</strong> – The options bitmask. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is already active. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_buffer_size">
<span class="target" id="mcc118_8h_1ab51ae2475203cd8fadedfcfc31dd9506"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_buffer_size</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer_size_samples</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_buffer_size" title="Link to this definition"></a><br /></dt>
<dd><p>Returns the size of the internal scan data buffer. </p>
<p>An internal data buffer is allocated for the scan when <a class="reference internal" href="#mcc118_8h_1a7bb6778d908b3513e7e64a1932bf7d38"><span class="std std-ref">mcc118_a_in_scan_start()</span></a> is called. This function returns the total size of that buffer in samples.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer_size_samples</strong> – Receives the size of the buffer in samples. Each sample is a <strong>double</strong>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan is not currently active, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a> if the address is invalid or buffer_size_samples is NULL. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_status">
<span class="target" id="mcc118_8h_1a81652d8ff8fd4efcea557d8886bbea1e"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_status</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">status</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">samples_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_status" title="Link to this definition"></a><br /></dt>
<dd><p>Reads status and number of available samples from an analog input scan. </p>
<p>The scan is started with <a class="reference internal" href="#mcc118_8h_1a7bb6778d908b3513e7e64a1932bf7d38"><span class="std std-ref">mcc118_a_in_scan_start()</span></a> and runs in a background thread that reads the data from the board into an internal scan buffer. This function reads the status of the scan and amount of data in the scan buffer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>status</strong> – Receives the scan status, an ORed combination of the flags:<ul>
<li><p><a class="reference internal" href="#daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"><span class="std std-ref">STATUS_HW_OVERRUN</span></a>: The device scan buffer was not read fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"><span class="std std-ref">STATUS_BUFFER_OVERRUN</span></a>: The thread scan buffer was not read by the user fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"><span class="std std-ref">STATUS_TRIGGERED</span></a>: The trigger conditions have been met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"><span class="std std-ref">STATUS_RUNNING</span></a>: The scan is running. </p></li>
</ul>
</p></li>
<li><p><strong>samples_per_channel</strong> – Receives the number of samples per channel available in the scan thread buffer. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan has not been started under this instance of the device. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_read">
<span class="target" id="mcc118_8h_1a1056c2b90b530ce6d0729d8ddb760662"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">status</span></span>, <span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="n"><span class="pre">samples_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">timeout</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">buffer_size_samples</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">samples_read_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_read" title="Link to this definition"></a><br /></dt>
<dd><p>Reads status and multiple samples from an analog input scan. </p>
<p>The scan is started with <a class="reference internal" href="#mcc118_8h_1a7bb6778d908b3513e7e64a1932bf7d38"><span class="std std-ref">mcc118_a_in_scan_start()</span></a> and runs in a background thread that reads the data from the board into an internal scan buffer. This function reads the data from the scan buffer, and returns the current scan status.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>status</strong> – Receives the scan status, an ORed combination of the flags:<ul>
<li><p><a class="reference internal" href="#daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"><span class="std std-ref">STATUS_HW_OVERRUN</span></a>: The device scan buffer was not read fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"><span class="std std-ref">STATUS_BUFFER_OVERRUN</span></a>: The thread scan buffer was not read by the user fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"><span class="std std-ref">STATUS_TRIGGERED</span></a>: The trigger conditions have been met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"><span class="std std-ref">STATUS_RUNNING</span></a>: The scan is running. </p></li>
</ul>
</p></li>
<li><p><strong>samples_per_channel</strong> – The number of samples per channel to read. Specify <strong>-1</strong> to read all available samples in the scan thread buffer, ignoring <strong>timeout</strong>. If <strong>buffer</strong> does not contain enough space then the function will read as many samples per channel as will fit in <strong>buffer</strong>. </p></li>
<li><p><strong>timeout</strong> – The amount of time in seconds to wait for the samples to be read. Specify a negative number to wait indefinitely or <strong>0</strong> to return immediately with whatever samples are available (up to the value of <strong>samples_per_channel</strong> or <strong>buffer_size_samples</strong>.) </p></li>
<li><p><strong>buffer</strong> – The user data buffer that receives the samples. </p></li>
<li><p><strong>buffer_size_samples</strong> – The size of the buffer in samples. Each sample is a <strong>double</strong>. </p></li>
<li><p><strong>samples_read_per_channel</strong> – Returns the actual number of samples read from each channel. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan is not active. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_channel_count">
<span class="target" id="mcc118_8h_1a35206710d53af68e1526314c33851cd1"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_channel_count</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_channel_count" title="Link to this definition"></a><br /></dt>
<dd><p>Return the number of channels in the current analog input scan. </p>
<p>This function returns 0 if no scan is active.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The number of channels, 0 - 8. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_stop">
<span class="target" id="mcc118_8h_1a361841e611dfe77ad25a49f102f3bbcd"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_stop</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_stop" title="Link to this definition"></a><br /></dt>
<dd><p>Stops an analog input scan. </p>
<p>The scan is stopped immediately. The scan data that has been read into the scan buffer is available until <a class="reference internal" href="#mcc118_8h_1ab11473109120c4734e43b340712972f3"><span class="std std-ref">mcc118_a_in_scan_cleanup()</span></a> is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc118_a_in_scan_cleanup">
<span class="target" id="mcc118_8h_1ab11473109120c4734e43b340712972f3"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc118_a_in_scan_cleanup</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc118_a_in_scan_cleanup" title="Link to this definition"></a><br /></dt>
<dd><p>Free analog input scan resources after the scan is complete. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

</section>
<section id="data-definitions">
<h3>Data definitions<a class="headerlink" href="#data-definitions" title="Link to this heading"></a></h3>
<section id="device-info">
<h4>Device Info<a class="headerlink" href="#device-info" title="Link to this heading"></a></h4>
<dl class="c struct">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo">
<span class="target" id="structMCC118DeviceInfo"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MCC118DeviceInfo</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 118 constant device information. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.NUM_AI_CHANNELS">
<span class="target" id="structMCC118DeviceInfo_1a7716e43e020482c72c668fc96a7e707e"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AI_CHANNELS</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.NUM_AI_CHANNELS" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog input channels (8.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.AI_MIN_CODE">
<span class="target" id="structMCC118DeviceInfo_1a09ae65990c7af02bd16edb6cfeca46ed"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_CODE</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.AI_MIN_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum ADC code (0.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.AI_MAX_CODE">
<span class="target" id="structMCC118DeviceInfo_1affc62ed9a07615ef044a206380c615ba"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_CODE</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.AI_MAX_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum ADC code (4095.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.AI_MIN_VOLTAGE">
<span class="target" id="structMCC118DeviceInfo_1a6c9a23e111966e1fa80ee8285d1571af"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.AI_MIN_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the minimum code (-10.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.AI_MAX_VOLTAGE">
<span class="target" id="structMCC118DeviceInfo_1ae1f2a594c35d377a008793f371af295d"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.AI_MAX_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the maximum code (+10.0V - 1 LSB.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.AI_MIN_RANGE">
<span class="target" id="structMCC118DeviceInfo_1a0d490a882fc6efa399fec20a6a1c4eb5"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_RANGE</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.AI_MIN_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum voltage of the input range (-10.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC118DeviceInfo.AI_MAX_RANGE">
<span class="target" id="structMCC118DeviceInfo_1a9d7000018484148909d97514251b5a25"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_RANGE</span></span></span><a class="headerlink" href="#c.MCC118DeviceInfo.AI_MAX_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum voltage of the input range (+10.0V.) </p>
</dd></dl>

</div>
</dd></dl>

</section>
</section>
</section>
<section id="mcc-128-functions-and-data">
<h2>MCC 128 functions and data<a class="headerlink" href="#mcc-128-functions-and-data" title="Link to this heading"></a></h2>
<section id="id2">
<h3>Functions<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Function</p></td>
<td><p>Description</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_open" title="mcc128_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_open()</span></code></a></p></td>
<td><p>Open an MCC 128 for use.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_is_open" title="mcc128_is_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_is_open()</span></code></a></p></td>
<td><p>Check if an MCC 128 is open.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_close" title="mcc128_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_close()</span></code></a></p></td>
<td><p>Close an MCC 128.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_info" title="mcc128_info"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_info()</span></code></a></p></td>
<td><p>Return information about this device type.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_blink_led" title="mcc128_blink_led"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_blink_led()</span></code></a></p></td>
<td><p>Blink the MCC 128 LED.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_firmware_version" title="mcc128_firmware_version"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_firmware_version()</span></code></a></p></td>
<td><p>Get the firmware version.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_serial" title="mcc128_serial"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_serial()</span></code></a></p></td>
<td><p>Read the serial number.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_calibration_date" title="mcc128_calibration_date"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_calibration_date()</span></code></a></p></td>
<td><p>Read the calibration date.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_calibration_coefficient_read" title="mcc128_calibration_coefficient_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_calibration_coefficient_read()</span></code></a></p></td>
<td><p>Read the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_calibration_coefficient_write" title="mcc128_calibration_coefficient_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_calibration_coefficient_write()</span></code></a></p></td>
<td><p>Write the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_trigger_mode" title="mcc128_trigger_mode"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_trigger_mode()</span></code></a></p></td>
<td><p>Set the external trigger input mode.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_mode_read" title="mcc128_a_in_mode_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_mode_read()</span></code></a></p></td>
<td><p>Read the analog input mode.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_a_in_mode_write" title="mcc128_a_in_mode_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_mode_write()</span></code></a></p></td>
<td><p>Write the analog input mode.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_range_read" title="mcc128_a_in_range_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_range_read()</span></code></a></p></td>
<td><p>Read the analog input range.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_a_in_range_write" title="mcc128_a_in_range_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_range_write()</span></code></a></p></td>
<td><p>Write the analog input range.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_read" title="mcc128_a_in_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_read()</span></code></a></p></td>
<td><p>Read an analog input value.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_actual_rate" title="mcc128_a_in_scan_actual_rate"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_actual_rate()</span></code></a></p></td>
<td><p>Read the actual sample rate for a set of scan parameters.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_start" title="mcc128_a_in_scan_start"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_start()</span></code></a></p></td>
<td><p>Start a hardware-paced analog input scan.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_buffer_size" title="mcc128_a_in_scan_buffer_size"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_buffer_size()</span></code></a></p></td>
<td><p>Read the size of the internal scan data buffer.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_status" title="mcc128_a_in_scan_status"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_status()</span></code></a></p></td>
<td><p>Read the scan status.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_read" title="mcc128_a_in_scan_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_read()</span></code></a></p></td>
<td><p>Read scan data and status.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_channel_count" title="mcc128_a_in_scan_channel_count"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_channel_count()</span></code></a></p></td>
<td><p>Get the number of channels in the current scan.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_stop" title="mcc128_a_in_scan_stop"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_stop()</span></code></a></p></td>
<td><p>Stop the scan.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc128_a_in_scan_cleanup" title="mcc128_a_in_scan_cleanup"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc128_a_in_scan_cleanup()</span></code></a></p></td>
<td><p>Free scan resources.</p></td>
</tr>
</tbody>
</table>
<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_open">
<span class="target" id="mcc128_8h_1af6ef529a7d95fb196aec38f1bc42fb76"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_open" title="Link to this definition"></a><br /></dt>
<dd><p>Open a connection to the MCC 128 device at the specified address. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_close">
<span class="target" id="mcc128_8h_1ab9cd9c442d5707ccb0ebbd5a7ec2d5a5"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_close</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_close" title="Link to this definition"></a><br /></dt>
<dd><p>Close a connection to an MCC 128 device and free allocated resources. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_is_open">
<span class="target" id="mcc128_8h_1aa5b9591403b7a0a3cf7f1e125498ed19"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_is_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_is_open" title="Link to this definition"></a><br /></dt>
<dd><p>Check if an MCC 128 is open. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>1 if open, 0 if not open. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_info">
<span class="target" id="mcc128_8h_1a987aafab070cff509072e9a2822431e4"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.MCC128DeviceInfo" title="MCC128DeviceInfo"><span class="n"><span class="pre">MCC128DeviceInfo</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_info</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_info" title="Link to this definition"></a><br /></dt>
<dd><p>Return constant device information for all MCC 128s. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Pointer to struct <a class="reference internal" href="#structMCC128DeviceInfo"><span class="std std-ref">MCC128DeviceInfo</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_blink_led">
<span class="target" id="mcc128_8h_1a46aa20ef483b565811dcd604cfd78159"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_blink_led</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">count</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_blink_led" title="Link to this definition"></a><br /></dt>
<dd><p>Blink the LED on the MCC 128. </p>
<p>Passing 0 for count will result in the LED blinking continuously until the board is reset or <a class="reference internal" href="#mcc128_8h_1a46aa20ef483b565811dcd604cfd78159"><span class="std std-ref">mcc128_blink_led()</span></a> is called again with a non-zero value for count.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
<li><p><strong>count</strong> – The number of times to blink (0 - 255). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_firmware_version">
<span class="target" id="mcc128_8h_1a2cf1ba5b16d1568d639e53d423463c11"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_firmware_version</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">version</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_firmware_version" title="Link to this definition"></a><br /></dt>
<dd><p>Return the board firmware version. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>version</strong> – Receives the firmware version. The version will be in BCD hexadecimal with the high byte as the major version and low byte as minor, i.e. 0x0103 is version 1.03. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_serial">
<span class="target" id="mcc128_8h_1a0839394c7739b21f8284e9de894f0cd1"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_serial</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_serial" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 128 serial number. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the serial number as a string. The buffer must be at least 9 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_calibration_date">
<span class="target" id="mcc128_8h_1aa8ae2b563e21630b063353f588342094"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_calibration_date</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_calibration_date" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 128 calibration date. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the date as a string (format “YYYY-MM-DD”). The buffer must be at least 11 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_calibration_coefficient_read">
<span class="target" id="mcc128_8h_1a0f71d51082db0561877e550e2ecd55d4"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_calibration_coefficient_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">range</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_calibration_coefficient_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 128 calibration coefficients for a specified input range. </p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>range</strong> – The input range, one of the <a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2a"><span class="std std-ref">input range</span></a> values. </p></li>
<li><p><strong>slope</strong> – Receives the slope. </p></li>
<li><p><strong>offset</strong> – Receives the offset. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_calibration_coefficient_write">
<span class="target" id="mcc128_8h_1a39e948b0ee81d7bfb4a3f5f8a2e7f772"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_calibration_coefficient_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">range</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_calibration_coefficient_write" title="Link to this definition"></a><br /></dt>
<dd><p>Temporarily write the MCC 128 calibration coefficients for a specified input range. </p>
<p>The user can apply their own calibration coefficients by writing to these values. The values will reset to the factory values from the EEPROM whenever <a class="reference internal" href="#mcc128_8h_1af6ef529a7d95fb196aec38f1bc42fb76"><span class="std std-ref">mcc128_open()</span></a> is called. This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>range</strong> – The input range, one of the <a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2a"><span class="std std-ref">input range</span></a> values. </p></li>
<li><p><strong>slope</strong> – The new slope value. </p></li>
<li><p><strong>offset</strong> – The new offset value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_mode_read">
<span class="target" id="mcc128_8h_1a72708b3fcd8897559ac62cf32d234ed7"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_mode_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">mode</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_mode_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the analog input mode. </p>
<p>Reads the current analog <a class="reference internal" href="#mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ad"><span class="std std-ref">input mode</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>mode</strong> – Receives the <a class="reference internal" href="#mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ad"><span class="std std-ref">input mode</span></a>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_mode_write">
<span class="target" id="mcc128_8h_1a08c74d97acefbf1b4f1c54fe2270be48"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_mode_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">mode</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_mode_write" title="Link to this definition"></a><br /></dt>
<dd><p>Set the analog input mode. </p>
<p>This sets the analog inputs to one of the valid values:<ul class="simple">
<li><p><a class="reference internal" href="#mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ada5ba52dfe56a54ab78d90faaa15d167f0"><span class="std std-ref">A_IN_MODE_SE</span></a>: Single-ended (8 inputs relative to ground.)</p></li>
<li><p><a class="reference internal" href="#mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ada5152a4c1606e17b1c18845e10e496714"><span class="std std-ref">A_IN_MODE_DIFF</span></a>: Differential (4 channels with positive and negative inputs.)</p></li>
</ul>
</p>
<p>This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>mode</strong> – One of the <a class="reference internal" href="#mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ad"><span class="std std-ref">input mode</span></a> values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_range_read">
<span class="target" id="mcc128_8h_1ad767ea9570bd8f35d77d57757c5a0192"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_range_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">range</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_range_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the analog input range. </p>
<p>Returns the current analog <a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2a"><span class="std std-ref">input range</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>range</strong> – Receives the <a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2a"><span class="std std-ref">input range</span></a>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_range_write">
<span class="target" id="mcc128_8h_1ac710c8f81c9ac6ad78cd3bf2f142c2d9"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_range_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">range</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_range_write" title="Link to this definition"></a><br /></dt>
<dd><p>Set the analog input range. </p>
<p>This sets the analog input range to one of the valid ranges:<ul class="simple">
<li><p><a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa6e66d937462a38d8b2348d9d18d575ac"><span class="std std-ref">A_IN_RANGE_BIP_10V</span></a>: +/- 10V</p></li>
<li><p><a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa023b365538a1acce7d2624a7dec2ba97"><span class="std std-ref">A_IN_RANGE_BIP_5V</span></a>: +/- 5V</p></li>
<li><p><a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa222c74908da4838e9bbc96bee0cae5af"><span class="std std-ref">A_IN_RANGE_BIP_2V</span></a>: +/- 2V</p></li>
<li><p><a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa56e5fb87b025f8b4bcf35ebb02235a57"><span class="std std-ref">A_IN_RANGE_BIP_1V</span></a>: +/- 1V</p></li>
</ul>
</p>
<p>This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>range</strong> – One of the <a class="reference internal" href="#mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2a"><span class="std std-ref">input range</span></a> values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_trigger_mode">
<span class="target" id="mcc128_8h_1a7e0a7e624f39e2b26aef6a837f8cc09e"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_trigger_mode</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">mode</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_trigger_mode" title="Link to this definition"></a><br /></dt>
<dd><p>Set the trigger input mode. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>mode</strong> – One of the <a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94a"><span class="std std-ref">trigger mode</span></a> values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_read">
<span class="target" id="mcc128_8h_1a8be6162571368ecb4df9309d14d1011b"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_read" title="Link to this definition"></a><br /></dt>
<dd><p>Perform a single reading of an analog input channel and return the value. </p>
<p>The valid options are:<ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a>: Return ADC code (a value between 0 and 65535) rather than voltage.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a>: Return data without the calibration factors applied.</p></li>
</ul>
</p>
<p>The options parameter is set to 0 or <a class="reference internal" href="#daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"><span class="std std-ref">OPTS_DEFAULT</span></a> for default operation, which is scaled and calibrated data.</p>
<p>Multiple options may be specified by ORing the flags. For instance, specifying <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> | <a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a> will return the value read from the ADC without calibration or converting to voltage.</p>
<p>The function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if called while a scan is running.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number, 0 - 7. </p></li>
<li><p><strong>options</strong> – Options bitmask. </p></li>
<li><p><strong>value</strong> – Receives the analog input value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_actual_rate">
<span class="target" id="mcc128_8h_1af93bd9fc62ae4d62850a2001fd03d32f"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_actual_rate</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel_count</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">sample_rate_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">actual_sample_rate_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_actual_rate" title="Link to this definition"></a><br /></dt>
<dd><p>Read the actual sample rate per channel for a requested sample rate. </p>
<p>The internal scan clock is generated from a 16 MHz clock source so only discrete frequency steps can be achieved. This function will return the actual rate for a requested channel count and rate. This function does not perform any actions with a board, it simply calculates the rate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>channel_count</strong> – The number of channels in the scan. </p></li>
<li><p><strong>sample_rate_per_channel</strong> – The desired sampling rate in samples per second per channel, max 100,000. </p></li>
<li><p><strong>actual_sample_rate_per_channel</strong> – The actual sample rate that would occur when requesting this rate on an MCC 128, or 0 if there is an error. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a> if the scan parameters are not achievable on an MCC 128. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_start">
<span class="target" id="mcc128_8h_1a391144b381b4e009f3b360a42ecb810b"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_start</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel_mask</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">samples_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">sample_rate_per_channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_start" title="Link to this definition"></a><br /></dt>
<dd><p>Start a hardware-paced analog input scan. </p>
<p>The scan runs as a separate thread from the user’s code. The function will allocate a scan buffer and read data from the device into that buffer. The user reads the data from this buffer and the scan status using the <a class="reference internal" href="#mcc128_8h_1a75bca340f02312ae653f807fbc04d334"><span class="std std-ref">mcc128_a_in_scan_read()</span></a> function. <a class="reference internal" href="#mcc128_8h_1a8b75fe424e94ebd18494cc4820f59ebc"><span class="std std-ref">mcc128_a_in_scan_stop()</span></a> is used to stop a continuous scan, or to stop a finite scan before it completes. The user must call <a class="reference internal" href="#mcc128_8h_1ada8e10b3bba0d848a89d66762d79224d"><span class="std std-ref">mcc128_a_in_scan_cleanup()</span></a> after the scan has finished and all desired data has been read; this frees all resources from the scan and allows additional scans to be performed.</p>
<p>The scan state has defined terminology:<ul class="simple">
<li><p><strong>Active:</strong> <a class="reference internal" href="#mcc128_8h_1a391144b381b4e009f3b360a42ecb810b"><span class="std std-ref">mcc128_a_in_scan_start()</span></a> has been called and the device may be acquiring data or finished with the acquisition. The scan has not been cleaned up by calling <a class="reference internal" href="#mcc128_8h_1ada8e10b3bba0d848a89d66762d79224d"><span class="std std-ref">mcc128_a_in_scan_cleanup()</span></a>, so another scan may not be started.</p></li>
<li><p><strong>Running:</strong> The scan is active and the device is still acquiring data. Certain functions like <a class="reference internal" href="#mcc128_8h_1a8be6162571368ecb4df9309d14d1011b"><span class="std std-ref">mcc128_a_in_read()</span></a> will return an error because the device is busy.</p></li>
</ul>
</p>
<p>The valid options are:<ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a>: Returns ADC code (a value between 0 and 65535) rather than voltage.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a>: Return data without the calibration factors applied.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a385c1e54c5caa4ddaab2bbed18a974a8"><span class="std std-ref">OPTS_EXTCLOCK</span></a>: Use an external 3.3V or 5V logic signal at the CLK input as the scan clock. Multiple devices can be synchronized by connecting the CLK pins together and using this option on all but one device so they will be clocked by the single device using its internal clock. <strong>sample_rate_per_channel</strong> is only used for buffer sizing.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1aa2c6cc0f41865f0885ab83c6aa446dc1"><span class="std std-ref">OPTS_EXTTRIGGER</span></a>: Hold off the scan (after calling <a class="reference internal" href="#mcc128_8h_1a391144b381b4e009f3b360a42ecb810b"><span class="std std-ref">mcc128_a_in_scan_start()</span></a>) until the trigger condition is met. The trigger is a 3.3V or 5V logic signal applied to the TRIG pin.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af34e1d3813b5909d7b8bf3012a2d829a"><span class="std std-ref">OPTS_CONTINUOUS</span></a>: Scans continuously until stopped by the user by calling <a class="reference internal" href="#mcc128_8h_1a8b75fe424e94ebd18494cc4820f59ebc"><span class="std std-ref">mcc128_a_in_scan_stop()</span></a> and writes data to a circular buffer. The data must be read before being overwritten to avoid a buffer overrun error. <strong>samples_per_channel</strong> is only used for buffer sizing.</p></li>
</ul>
</p>
<p>The options parameter is set to 0 or <a class="reference internal" href="#daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"><span class="std std-ref">OPTS_DEFAULT</span></a> for default operation, which is scaled and calibrated data, internal scan clock, no trigger, and finite operation.</p>
<p>Multiple options may be specified by ORing the flags. For instance, specifying <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> | <a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a> will return the values read from the ADC without calibration or converting to voltage.</p>
<p>The buffer size will be allocated as follows:</p>
<p><strong>Finite</strong> mode: Total number of samples in the scan</p>
<p><strong>Continuous</strong> mode (buffer size is per channel): Either <strong>samples_per_channel</strong> or the value in the following table, whichever is greater</p>
<p><table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Sample Rate   </p></th>
<th class="head"><p>Buffer Size (per channel)    </p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Not specified   </p></td>
<td><p>10 kS    </p></td>
</tr>
<tr class="row-odd"><td><p>0-100 S/s   </p></td>
<td><p>1 kS    </p></td>
</tr>
<tr class="row-even"><td><p>100-10k S/s   </p></td>
<td><p>10 kS    </p></td>
</tr>
<tr class="row-odd"><td><p>10k-100k S/s   </p></td>
<td><p>100 kS   </p></td>
</tr>
</tbody>
</table>
</p>
<p>Specifying a very large value for <strong>samples_per_channel</strong> could use too much of the Raspberry Pi memory. If the memory allocation fails, the function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a>. The allocation could succeed, but the lack of free memory could cause other problems in the Raspberry Pi. If you need to acquire a high number of samples then it is better to run the scan in continuous mode and stop it when you have acquired the desired amount of data. If a scan is already active this function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel_mask</strong> – A bit mask of the channels to be scanned. Set each bit to enable the associated channel (0x01 - 0xFF.) </p></li>
<li><p><strong>samples_per_channel</strong> – The number of samples to acquire for each channel in the scan (finite mode), or can be used to set a larger scan buffer size than the default value (continuous mode.) </p></li>
<li><p><strong>sample_rate_per_channel</strong> – The sampling rate in samples per second per channel, max 100,000. When using an external sample clock set this value to the maximum expected rate of the clock. </p></li>
<li><p><strong>options</strong> – The options bitmask. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is already active. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_buffer_size">
<span class="target" id="mcc128_8h_1addf316215c0866e92ff66bd23828442d"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_buffer_size</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer_size_samples</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_buffer_size" title="Link to this definition"></a><br /></dt>
<dd><p>Returns the size of the internal scan data buffer. </p>
<p>An internal data buffer is allocated for the scan when <a class="reference internal" href="#mcc128_8h_1a391144b381b4e009f3b360a42ecb810b"><span class="std std-ref">mcc128_a_in_scan_start()</span></a> is called. This function returns the total size of that buffer in samples.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer_size_samples</strong> – Receives the size of the buffer in samples. Each sample is a <strong>double</strong>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan is not currently active, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a> if the address is invalid or buffer_size_samples is NULL. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_status">
<span class="target" id="mcc128_8h_1a446895b17a1ffa860a8ab52e3b24a775"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_status</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">status</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">samples_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_status" title="Link to this definition"></a><br /></dt>
<dd><p>Reads status and number of available samples from an analog input scan. </p>
<p>The scan is started with <a class="reference internal" href="#mcc128_8h_1a391144b381b4e009f3b360a42ecb810b"><span class="std std-ref">mcc128_a_in_scan_start()</span></a> and runs in a background thread that reads the data from the board into an internal scan buffer. This function reads the status of the scan and amount of data in the scan buffer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>status</strong> – Receives the scan status, an ORed combination of the flags:<ul>
<li><p><a class="reference internal" href="#daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"><span class="std std-ref">STATUS_HW_OVERRUN</span></a>: The device scan buffer was not read fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"><span class="std std-ref">STATUS_BUFFER_OVERRUN</span></a>: The thread scan buffer was not read by the user fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"><span class="std std-ref">STATUS_TRIGGERED</span></a>: The trigger conditions have been met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"><span class="std std-ref">STATUS_RUNNING</span></a>: The scan is running. </p></li>
</ul>
</p></li>
<li><p><strong>samples_per_channel</strong> – Receives the number of samples per channel available in the scan thread buffer. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan has not been started under this instance of the device. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_read">
<span class="target" id="mcc128_8h_1a75bca340f02312ae653f807fbc04d334"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">status</span></span>, <span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="n"><span class="pre">samples_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">timeout</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">buffer_size_samples</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">samples_read_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_read" title="Link to this definition"></a><br /></dt>
<dd><p>Reads status and multiple samples from an analog input scan. </p>
<p>The scan is started with <a class="reference internal" href="#mcc128_8h_1a391144b381b4e009f3b360a42ecb810b"><span class="std std-ref">mcc128_a_in_scan_start()</span></a> and runs in a background thread that reads the data from the board into an internal scan buffer. This function reads the data from the scan buffer, and returns the current scan status.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>status</strong> – Receives the scan status, an ORed combination of the flags:<ul>
<li><p><a class="reference internal" href="#daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"><span class="std std-ref">STATUS_HW_OVERRUN</span></a>: The device scan buffer was not read fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"><span class="std std-ref">STATUS_BUFFER_OVERRUN</span></a>: The thread scan buffer was not read by the user fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"><span class="std std-ref">STATUS_TRIGGERED</span></a>: The trigger conditions have been met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"><span class="std std-ref">STATUS_RUNNING</span></a>: The scan is running. </p></li>
</ul>
</p></li>
<li><p><strong>samples_per_channel</strong> – The number of samples per channel to read. Specify <strong>-1</strong> to read all available samples in the scan thread buffer, ignoring <strong>timeout</strong>. If <strong>buffer</strong> does not contain enough space then the function will read as many samples per channel as will fit in <strong>buffer</strong>. </p></li>
<li><p><strong>timeout</strong> – The amount of time in seconds to wait for the samples to be read. Specify a negative number to wait indefinitely or <strong>0</strong> to return immediately with whatever samples are available (up to the value of <strong>samples_per_channel</strong> or <strong>buffer_size_samples</strong>.) </p></li>
<li><p><strong>buffer</strong> – The user data buffer that receives the samples. </p></li>
<li><p><strong>buffer_size_samples</strong> – The size of the buffer in samples. Each sample is a <strong>double</strong>. </p></li>
<li><p><strong>samples_read_per_channel</strong> – Returns the actual number of samples read from each channel. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan is not active. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_channel_count">
<span class="target" id="mcc128_8h_1a6969a2fdaf0ad4d1447d9bb91a8b618b"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_channel_count</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_channel_count" title="Link to this definition"></a><br /></dt>
<dd><p>Return the number of channels in the current analog input scan. </p>
<p>This function returns 0 if no scan is active.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The number of channels, 0 - 8. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_stop">
<span class="target" id="mcc128_8h_1a8b75fe424e94ebd18494cc4820f59ebc"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_stop</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_stop" title="Link to this definition"></a><br /></dt>
<dd><p>Stops an analog input scan. </p>
<p>The scan is stopped immediately. The scan data that has been read into the scan buffer is available until <a class="reference internal" href="#mcc128_8h_1ada8e10b3bba0d848a89d66762d79224d"><span class="std std-ref">mcc128_a_in_scan_cleanup()</span></a> is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc128_a_in_scan_cleanup">
<span class="target" id="mcc128_8h_1ada8e10b3bba0d848a89d66762d79224d"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc128_a_in_scan_cleanup</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc128_a_in_scan_cleanup" title="Link to this definition"></a><br /></dt>
<dd><p>Free analog input scan resources after the scan is complete. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

</section>
<section id="id3">
<h3>Data definitions<a class="headerlink" href="#id3" title="Link to this heading"></a></h3>
<section id="id4">
<h4>Device Info<a class="headerlink" href="#id4" title="Link to this heading"></a></h4>
<dl class="c struct">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo">
<span class="target" id="structMCC128DeviceInfo"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MCC128DeviceInfo</span></span></span><a class="headerlink" href="#c.MCC128DeviceInfo" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 128 constant device information. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.NUM_AI_MODES">
<span class="target" id="structMCC128DeviceInfo_1a171dceb761283b671c6e3efd3a7b11c7"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AI_MODES</span></span></span><a class="headerlink" href="#c.MCC128DeviceInfo.NUM_AI_MODES" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog input modes (2.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.NUM_AI_CHANNELS">
<span class="target" id="structMCC128DeviceInfo_1a6e8fb757331926e9d237ac87f24725ab"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AI_CHANNELS</span></span></span><span class="p"><span class="pre">[</span></span><span class="m"><span class="pre">2</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#c.MCC128DeviceInfo.NUM_AI_CHANNELS" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog input channels in each mode (8, 4.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.AI_MIN_CODE">
<span class="target" id="structMCC128DeviceInfo_1ab878ee3db2e8d96b8989144cb5a95e15"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_CODE</span></span></span><a class="headerlink" href="#c.MCC128DeviceInfo.AI_MIN_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum ADC code (0.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.AI_MAX_CODE">
<span class="target" id="structMCC128DeviceInfo_1a71ed389061548c2a23a87169c5cf2955"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_CODE</span></span></span><a class="headerlink" href="#c.MCC128DeviceInfo.AI_MAX_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum ADC code (65535.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.NUM_AI_RANGES">
<span class="target" id="structMCC128DeviceInfo_1a7b6b5953d858360182af1d5847e4f298"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AI_RANGES</span></span></span><a class="headerlink" href="#c.MCC128DeviceInfo.NUM_AI_RANGES" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog input ranges (4.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.AI_MIN_VOLTAGE">
<span class="target" id="structMCC128DeviceInfo_1a561bd3a5429459c3d8f0e659234666b9"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_VOLTAGE</span></span></span><span class="p"><span class="pre">[</span></span><span class="m"><span class="pre">4</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#c.MCC128DeviceInfo.AI_MIN_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the minimum code in each range (-10.0V, -5.0V, -2.0V, -1.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.AI_MAX_VOLTAGE">
<span class="target" id="structMCC128DeviceInfo_1a3caa1a0466cc88f496d16ee7daeab11b"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_VOLTAGE</span></span></span><span class="p"><span class="pre">[</span></span><span class="m"><span class="pre">4</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#c.MCC128DeviceInfo.AI_MAX_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the maximum code in each range (+10.0V - 1 LSB, +5.0V - 1 LSB, +2.0V - 1 LSB, +1.0V - 1 LSB.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.AI_MIN_RANGE">
<span class="target" id="structMCC128DeviceInfo_1a1fc853e2f426ecbd21c894062ae0fc37"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_RANGE</span></span></span><span class="p"><span class="pre">[</span></span><span class="m"><span class="pre">4</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#c.MCC128DeviceInfo.AI_MIN_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum voltage of the input range in each range (-10.0V, -5.0V, -2.0V, -1.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC128DeviceInfo.AI_MAX_RANGE">
<span class="target" id="structMCC128DeviceInfo_1a9c88a6cbe6527e1ab318255275ba4bdd"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_RANGE</span></span></span><span class="p"><span class="pre">[</span></span><span class="m"><span class="pre">4</span></span><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#c.MCC128DeviceInfo.AI_MAX_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum voltage of the input range in each range (+10.0V, +5.0V, +2.0V, +1.0V.) </p>
</dd></dl>

</div>
</dd></dl>

</section>
<section id="analog-input-modes">
<h4>Analog Input Modes<a class="headerlink" href="#analog-input-modes" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.AnalogInputMode">
<span class="target" id="mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ad"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AnalogInputMode</span></span></span><a class="headerlink" href="#c.AnalogInputMode" title="Link to this definition"></a><br /></dt>
<dd><p>Analog input modes. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.AnalogInputMode.A_IN_MODE_SE">
<span class="target" id="mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ada5ba52dfe56a54ab78d90faaa15d167f0"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">A_IN_MODE_SE</span></span></span><a class="headerlink" href="#c.AnalogInputMode.A_IN_MODE_SE" title="Link to this definition"></a><br /></dt>
<dd><p>Single-ended. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.AnalogInputMode.A_IN_MODE_DIFF">
<span class="target" id="mcc128_8h_1a72990e90fe7b6074f9431dae4b8e20ada5152a4c1606e17b1c18845e10e496714"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">A_IN_MODE_DIFF</span></span></span><a class="headerlink" href="#c.AnalogInputMode.A_IN_MODE_DIFF" title="Link to this definition"></a><br /></dt>
<dd><p>Differential. </p>
</dd></dl>

</dd></dl>

</section>
<section id="analog-input-ranges">
<h4>Analog Input Ranges<a class="headerlink" href="#analog-input-ranges" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.AnalogInputRange">
<span class="target" id="mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2a"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AnalogInputRange</span></span></span><a class="headerlink" href="#c.AnalogInputRange" title="Link to this definition"></a><br /></dt>
<dd><p>Analog input ranges. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.AnalogInputRange.A_IN_RANGE_BIP_10V">
<span class="target" id="mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa6e66d937462a38d8b2348d9d18d575ac"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">A_IN_RANGE_BIP_10V</span></span></span><a class="headerlink" href="#c.AnalogInputRange.A_IN_RANGE_BIP_10V" title="Link to this definition"></a><br /></dt>
<dd><p>+/- 10 V </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.AnalogInputRange.A_IN_RANGE_BIP_5V">
<span class="target" id="mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa023b365538a1acce7d2624a7dec2ba97"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">A_IN_RANGE_BIP_5V</span></span></span><a class="headerlink" href="#c.AnalogInputRange.A_IN_RANGE_BIP_5V" title="Link to this definition"></a><br /></dt>
<dd><p>+/- 5 V </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.AnalogInputRange.A_IN_RANGE_BIP_2V">
<span class="target" id="mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa222c74908da4838e9bbc96bee0cae5af"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">A_IN_RANGE_BIP_2V</span></span></span><a class="headerlink" href="#c.AnalogInputRange.A_IN_RANGE_BIP_2V" title="Link to this definition"></a><br /></dt>
<dd><p>+/- 2 V </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.AnalogInputRange.A_IN_RANGE_BIP_1V">
<span class="target" id="mcc128_8h_1a3a0f69467f757289984a7e7d1bc7ab2aa56e5fb87b025f8b4bcf35ebb02235a57"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">A_IN_RANGE_BIP_1V</span></span></span><a class="headerlink" href="#c.AnalogInputRange.A_IN_RANGE_BIP_1V" title="Link to this definition"></a><br /></dt>
<dd><p>+/- 1 V </p>
</dd></dl>

</dd></dl>

</section>
</section>
</section>
<section id="mcc-134-functions-and-data">
<h2>MCC 134 functions and data<a class="headerlink" href="#mcc-134-functions-and-data" title="Link to this heading"></a></h2>
<section id="id5">
<h3>Functions<a class="headerlink" href="#id5" title="Link to this heading"></a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Function</p></td>
<td><p>Description</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_open" title="mcc134_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_open()</span></code></a></p></td>
<td><p>Open an MCC 134 for use.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_is_open" title="mcc134_is_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_is_open()</span></code></a></p></td>
<td><p>Check if an MCC 134 is open.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_close" title="mcc134_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_close()</span></code></a></p></td>
<td><p>Close an MCC 134.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_info" title="mcc134_info"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_info()</span></code></a></p></td>
<td><p>Return information about this device type.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_serial" title="mcc134_serial"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_serial()</span></code></a></p></td>
<td><p>Read the serial number.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_calibration_date" title="mcc134_calibration_date"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_calibration_date()</span></code></a></p></td>
<td><p>Read the calibration date.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_calibration_coefficient_read" title="mcc134_calibration_coefficient_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_calibration_coefficient_read()</span></code></a></p></td>
<td><p>Read the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_calibration_coefficient_write" title="mcc134_calibration_coefficient_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_calibration_coefficient_write()</span></code></a></p></td>
<td><p>Write the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_tc_type_write" title="mcc134_tc_type_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_tc_type_write()</span></code></a></p></td>
<td><p>Write the thermocouple type for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_tc_type_read" title="mcc134_tc_type_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_tc_type_read()</span></code></a></p></td>
<td><p>Read the thermocouple type for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_update_interval_write" title="mcc134_update_interval_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_update_interval_write()</span></code></a></p></td>
<td><p>Write the temperature update interval.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_update_interval_read" title="mcc134_update_interval_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_update_interval_read()</span></code></a></p></td>
<td><p>Read the temperature update interval.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_t_in_read" title="mcc134_t_in_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_t_in_read()</span></code></a></p></td>
<td><p>Read a temperature input value.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc134_a_in_read" title="mcc134_a_in_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_a_in_read()</span></code></a></p></td>
<td><p>Read an analog input value.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc134_cjc_read" title="mcc134_cjc_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc134_cjc_read()</span></code></a></p></td>
<td><p>Read a CJC temperature.</p></td>
</tr>
</tbody>
</table>
<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_open">
<span class="target" id="mcc134_8h_1a311d4a95c74b3d06eac9b6abf49b5571"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_open" title="Link to this definition"></a><br /></dt>
<dd><p>Open a connection to the MCC 134 device at the specified address. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_is_open">
<span class="target" id="mcc134_8h_1aea1fb83ad1aa7a7b3f02c928aff11afe"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_is_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_is_open" title="Link to this definition"></a><br /></dt>
<dd><p>Check if an MCC 134 is open. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>1 if open, 0 if not open. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_close">
<span class="target" id="mcc134_8h_1a56c28f0baa5cb441d5c310cbb186899e"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_close</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_close" title="Link to this definition"></a><br /></dt>
<dd><p>Close a connection to an MCC 134 device and free allocated resources. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_info">
<span class="target" id="mcc134_8h_1af28ba59f57fc756457b89e47f79c89ec"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.MCC134DeviceInfo" title="MCC134DeviceInfo"><span class="n"><span class="pre">MCC134DeviceInfo</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_info</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_info" title="Link to this definition"></a><br /></dt>
<dd><p>Return constant device information for all MCC 134s. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Pointer to struct <a class="reference internal" href="#structMCC134DeviceInfo"><span class="std std-ref">MCC134DeviceInfo</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_serial">
<span class="target" id="mcc134_8h_1aaef269f14927f3065dc5eeceacce44a8"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_serial</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_serial" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 134 serial number. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the serial number as a string. The buffer must be at least 9 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_calibration_date">
<span class="target" id="mcc134_8h_1a888e3a00588cf1cf66ee4793055b5734"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_calibration_date</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_calibration_date" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 134 calibration date. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the date as a string (format “YYYY-MM-DD”). The buffer must be at least 11 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_calibration_coefficient_read">
<span class="target" id="mcc134_8h_1aa75961dbaf8865e010db73067c097e15"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_calibration_coefficient_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_calibration_coefficient_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 134 calibration coefficients for a single channel. </p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 3). </p></li>
<li><p><strong>slope</strong> – Receives the slope. </p></li>
<li><p><strong>offset</strong> – Receives the offset. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_calibration_coefficient_write">
<span class="target" id="mcc134_8h_1afaf25f8367254b899c86486fb227304e"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_calibration_coefficient_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_calibration_coefficient_write" title="Link to this definition"></a><br /></dt>
<dd><p>Temporarily write the MCC 134 calibration coefficients for a single channel. </p>
<p>The user can apply their own calibration coefficients by writing to these values. The values will reset to the factory values from the EEPROM whenever <a class="reference internal" href="#mcc134_8h_1a311d4a95c74b3d06eac9b6abf49b5571"><span class="std std-ref">mcc134_open()</span></a> is called.</p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 3). </p></li>
<li><p><strong>slope</strong> – The new slope value. </p></li>
<li><p><strong>offset</strong> – The new offset value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_tc_type_write">
<span class="target" id="mcc134_8h_1a3175534a5379ca5e47488e0d635f9367"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_tc_type_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">type</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_tc_type_write" title="Link to this definition"></a><br /></dt>
<dd><p>Write the thermocouple type for a channel. </p>
<p>Tells the MCC 134 library what thermocouple type is connected to the specified channel and enables the channel. This is required for correct temperature calculations. The type is one of <a class="reference internal" href="#mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7"><span class="std std-ref">TcTypes</span></a> and the board will default to all disabled (set to <a class="reference internal" href="#mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7a92225667217ae34597b91610df09fe5c"><span class="std std-ref">TC_DISABLED</span></a>) when it is first opened.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number (0 - 3). </p></li>
<li><p><strong>type</strong> – The thermocouple type, one of <a class="reference internal" href="#mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7"><span class="std std-ref">TcTypes</span></a>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_tc_type_read">
<span class="target" id="mcc134_8h_1a47c4803f6b8fedb34c9b6455e43265bf"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_tc_type_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">type</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_tc_type_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the thermocouple type for a channel. </p>
<p>Reads the current thermocouple type for the specified channel. The type is one of <a class="reference internal" href="#mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7"><span class="std std-ref">TcTypes</span></a> and the board will default to all channels disabled (set to <a class="reference internal" href="#mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7a92225667217ae34597b91610df09fe5c"><span class="std std-ref">TC_DISABLED</span></a>) when it is first opened.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number (0 - 3). </p></li>
<li><p><strong>type</strong> – Receives the thermocouple type, one of <a class="reference internal" href="#mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7"><span class="std std-ref">TcTypes</span></a>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_update_interval_write">
<span class="target" id="mcc134_8h_1ab9d3904e0d97fb66f7d3325b3200251e"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_update_interval_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">interval</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_update_interval_write" title="Link to this definition"></a><br /></dt>
<dd><p>Write the temperature update interval. </p>
<p>Tells the MCC 134 library how often to update temperatures, with the interval specified in seconds. The library defaults to updating every second, but you may increase this interval if you do not plan to call <a class="reference internal" href="#mcc134_8h_1a2e95aee5299a83290571a3995ca1bfc9"><span class="std std-ref">mcc134_t_in_read()</span></a> very often. This will reduce the load on shared resources for other DAQ HATs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>interval</strong> – The interval in seconds (1 - 255). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_update_interval_read">
<span class="target" id="mcc134_8h_1ab51b7d5856a12a2f04b7414790cc21df"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_update_interval_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">interval</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_update_interval_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the temperature update interval. </p>
<p>Reads the library temperature update rate in seconds.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>interval</strong> – Receives the update rate. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_t_in_read">
<span class="target" id="mcc134_8h_1a2e95aee5299a83290571a3995ca1bfc9"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_t_in_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_t_in_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read a temperature input channel. </p>
<p>Reads the specified channel and returns the value as degrees Celsius. The channel must be enabled with <a class="reference internal" href="#mcc134_8h_1a3175534a5379ca5e47488e0d635f9367"><span class="std std-ref">mcc134_tc_type_write()</span></a> or the function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a>.</p>
<p>This function returns immediately with the most recent internal temperature reading for the specified channel. When a board is open, the library will read each channel once per second. This interval can be increased with <a class="reference internal" href="#mcc134_8h_1ab9d3904e0d97fb66f7d3325b3200251e"><span class="std std-ref">mcc134_update_interval_write()</span></a>. There will be a delay when the board is first opened because the read thread has to read the cold junction compensation sensors and thermocouple inputs before it can return the first value.</p>
<p>The returned temperature can have some special values to indicate abnormal conditions:<ul class="simple">
<li><p><a class="reference internal" href="#mcc134_8h_1a24936b0627fd548fbcbd5822bd00c208"><span class="std std-ref">OPEN_TC_VALUE</span></a> if an open thermocouple is detected on the channel.</p></li>
<li><p><a class="reference internal" href="#mcc134_8h_1a978d111e8cfabf0c23cdff98174ee88d"><span class="std std-ref">OVERRANGE_TC_VALUE</span></a> if an overrange is detected on the channel.</p></li>
<li><p><a class="reference internal" href="#mcc134_8h_1adc744e799770f9d327e77e011779180d"><span class="std std-ref">COMMON_MODE_TC_VALUE</span></a> if a common-mode error is detected on the channel. This occurs when thermocouples attached to the board are at different voltages.</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number (0 - 3.) </p></li>
<li><p><strong>value</strong> – Receives the temperature value in degrees C. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_a_in_read">
<span class="target" id="mcc134_8h_1a26c4472d7301c0dca000e91db7c5be6b"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_a_in_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_a_in_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read an analog input channel and return the value. </p>
<p>This function returns immediately with the most recent voltage or ADC code reading for the specified channel. The channel must be enabled with <a class="reference internal" href="#mcc134_8h_1a3175534a5379ca5e47488e0d635f9367"><span class="std std-ref">mcc134_tc_type_write()</span></a> or the function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a>.</p>
<p>The library reads the ADC at the time interval set with <a class="reference internal" href="#mcc134_8h_1ab9d3904e0d97fb66f7d3325b3200251e"><span class="std std-ref">mcc134_update_interval_write()</span></a>, which defaults to 1 second. This interval may be increased with <a class="reference internal" href="#mcc134_8h_1ab9d3904e0d97fb66f7d3325b3200251e"><span class="std std-ref">mcc134_update_interval_write()</span></a>.</p>
<p>The returned voltage can have a special value to indicate abnormal conditions:<ul class="simple">
<li><p><a class="reference internal" href="#mcc134_8h_1adc744e799770f9d327e77e011779180d"><span class="std std-ref">COMMON_MODE_TC_VALUE</span></a> if a common-mode error is detected on the channel. This occurs when thermocouples attached to the board are at different voltages.</p></li>
</ul>
</p>
<p>The valid options are:<ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a>: Return ADC code (a value between -8,388,608 and 8,388,607) rather than voltage.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a>: Return data without the calibration factors applied.</p></li>
</ul>
</p>
<p>The options parameter is set to 0 or <a class="reference internal" href="#daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"><span class="std std-ref">OPTS_DEFAULT</span></a> for default operation, which is scaled and calibrated data.</p>
<p>Multiple options may be specified by ORing the flags. For instance, specifying <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> | <a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a> will return the value read from the ADC without calibration or converting to voltage.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number (0 - 3). </p></li>
<li><p><strong>options</strong> – Options bitmask. </p></li>
<li><p><strong>value</strong> – Receives the analog input value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc134_cjc_read">
<span class="target" id="mcc134_8h_1a172e1f9d9bea991f61c89e24a0c4d6cd"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc134_cjc_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc134_cjc_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the cold junction compensation temperature for a specified channel. </p>
<p>Returns the most recent cold junction sensor temperature for the specified thermocouple terminal. The library automatically performs cold junction compensation, so this function is only needed for informational use or if you want to perform your own compensation. The temperature is returned in degress C.</p>
<p>The library reads the cold junction compensation sensors at the time interval set with <a class="reference internal" href="#mcc134_8h_1ab9d3904e0d97fb66f7d3325b3200251e"><span class="std std-ref">mcc134_update_interval_write()</span></a>, which defaults to 1 second. This interval may be increased with <a class="reference internal" href="#mcc134_8h_1ab9d3904e0d97fb66f7d3325b3200251e"><span class="std std-ref">mcc134_update_interval_write()</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog input channel number, 0 - 3. </p></li>
<li><p><strong>value</strong> – Receives the read value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

</section>
<section id="id6">
<h3>Data definitions<a class="headerlink" href="#id6" title="Link to this heading"></a></h3>
<dl class="c macro">
<dt class="sig sig-object c" id="c.OPEN_TC_VALUE">
<span class="target" id="mcc134_8h_1a24936b0627fd548fbcbd5822bd00c208"></span><span class="sig-name descname"><span class="n"><span class="pre">OPEN_TC_VALUE</span></span></span> <span class="pre">(-9999.0)</span><a class="headerlink" href="#c.OPEN_TC_VALUE" title="Link to this definition"></a><br /></dt>
<dd><p>Return value for an open thermocouple. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.OVERRANGE_TC_VALUE">
<span class="target" id="mcc134_8h_1a978d111e8cfabf0c23cdff98174ee88d"></span><span class="sig-name descname"><span class="n"><span class="pre">OVERRANGE_TC_VALUE</span></span></span> <span class="pre">(-8888.0)</span><a class="headerlink" href="#c.OVERRANGE_TC_VALUE" title="Link to this definition"></a><br /></dt>
<dd><p>Return value for thermocouple voltage outside the valid range. </p>
</dd></dl>

<dl class="c macro">
<dt class="sig sig-object c" id="c.COMMON_MODE_TC_VALUE">
<span class="target" id="mcc134_8h_1adc744e799770f9d327e77e011779180d"></span><span class="sig-name descname"><span class="n"><span class="pre">COMMON_MODE_TC_VALUE</span></span></span> <span class="pre">(-7777.0)</span><a class="headerlink" href="#c.COMMON_MODE_TC_VALUE" title="Link to this definition"></a><br /></dt>
<dd><p>Return value for thermocouple voltage outside the common-mode range. </p>
</dd></dl>

<section id="id7">
<h4>Device Info<a class="headerlink" href="#id7" title="Link to this heading"></a></h4>
<dl class="c struct">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo">
<span class="target" id="structMCC134DeviceInfo"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MCC134DeviceInfo</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 134 constant device information. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.NUM_AI_CHANNELS">
<span class="target" id="structMCC134DeviceInfo_1a9501cd02ddd2bbd446a9be0b84e5ac8c"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AI_CHANNELS</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.NUM_AI_CHANNELS" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog input channels (4.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.AI_MIN_CODE">
<span class="target" id="structMCC134DeviceInfo_1ab8859dc09e548f08f52f88009c3b3fe1"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_CODE</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.AI_MIN_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum ADC code (-8,388,608.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.AI_MAX_CODE">
<span class="target" id="structMCC134DeviceInfo_1a83c59cf3d3bac50b03171292d34e308d"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_CODE</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.AI_MAX_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum ADC code (8,388,607.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.AI_MIN_VOLTAGE">
<span class="target" id="structMCC134DeviceInfo_1a46cc7f603747923cb3c0ee397351342d"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.AI_MIN_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the minimum code (-0.078125V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.AI_MAX_VOLTAGE">
<span class="target" id="structMCC134DeviceInfo_1afde54a1290995168949db397d94ac268"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.AI_MAX_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the maximum code (+0.078125V - 1 LSB.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.AI_MIN_RANGE">
<span class="target" id="structMCC134DeviceInfo_1aa6c54c554dc7d8bf54d5879eac0ab52c"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_RANGE</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.AI_MIN_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum voltage of the input range (-0.078125V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC134DeviceInfo.AI_MAX_RANGE">
<span class="target" id="structMCC134DeviceInfo_1af0a8d13399d70f7162c29d491a64ffe4"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_RANGE</span></span></span><a class="headerlink" href="#c.MCC134DeviceInfo.AI_MAX_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum voltage of the input range (0.078125V.) </p>
</dd></dl>

</div>
</dd></dl>

</section>
<section id="thermocouple-types">
<h4>Thermocouple Types<a class="headerlink" href="#thermocouple-types" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.TcTypes">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TcTypes</span></span></span><a class="headerlink" href="#c.TcTypes" title="Link to this definition"></a><br /></dt>
<dd><p>Thermocouple type constants. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_J">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7a0041036811e8022abae0eea50b9ef75f"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_J</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_J" title="Link to this definition"></a><br /></dt>
<dd><p>J type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_K">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7abb4e06bcac96719b0df58db42a4a4c6a"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_K</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_K" title="Link to this definition"></a><br /></dt>
<dd><p>K type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_T">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7a480f2a759e0e2418b8b1a42cda654ac7"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_T</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_T" title="Link to this definition"></a><br /></dt>
<dd><p>T type </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_E">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7ad69693c3b754e823067262daf8ec24f9"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_E</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_E" title="Link to this definition"></a><br /></dt>
<dd><p>E type </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_R">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7ac66bdd0ac9c7225e54a3777accd8937f"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_R</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_R" title="Link to this definition"></a><br /></dt>
<dd><p>R type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_S">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7aae88c34e2c93e18b046668cbd00b177b"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_S</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_S" title="Link to this definition"></a><br /></dt>
<dd><p>S type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_B">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7ae52b6238d7482aa6db7e5e7f174c49b0"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_B</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_B" title="Link to this definition"></a><br /></dt>
<dd><p>B type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_TYPE_N">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7ab055f8716e28b8f991ef969c8c8cc203"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_TYPE_N</span></span></span><a class="headerlink" href="#c.TcTypes.TC_TYPE_N" title="Link to this definition"></a><br /></dt>
<dd><p>N type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.TcTypes.TC_DISABLED">
<span class="target" id="mcc134_8h_1a7af55e89d2a4390c9a69ecea583ce1c7a92225667217ae34597b91610df09fe5c"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">TC_DISABLED</span></span></span><a class="headerlink" href="#c.TcTypes.TC_DISABLED" title="Link to this definition"></a><br /></dt>
<dd><p>Input disabled. </p>
</dd></dl>

</dd></dl>

</section>
</section>
</section>
<section id="mcc-152-functions-and-data">
<h2>MCC 152 functions and data<a class="headerlink" href="#mcc-152-functions-and-data" title="Link to this heading"></a></h2>
<section id="id8">
<h3>Functions<a class="headerlink" href="#id8" title="Link to this heading"></a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Function</p></td>
<td><p>Description</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_open" title="mcc152_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_open()</span></code></a></p></td>
<td><p>Open an MCC 152 for use.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_is_open" title="mcc152_is_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_is_open()</span></code></a></p></td>
<td><p>Check if an MCC 152 is open.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_close" title="mcc152_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_close()</span></code></a></p></td>
<td><p>Close an MCC 152.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_info" title="mcc152_info"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_info()</span></code></a></p></td>
<td><p>Return information about this device type.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_serial" title="mcc152_serial"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_serial()</span></code></a></p></td>
<td><p>Read the serial number.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_a_out_write" title="mcc152_a_out_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_a_out_write()</span></code></a></p></td>
<td><p>Write an analog output channel value.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_a_out_write_all" title="mcc152_a_out_write_all"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_a_out_write_all()</span></code></a></p></td>
<td><p>Write all analog output channels simultaneously.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_reset" title="mcc152_dio_reset"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_reset()</span></code></a></p></td>
<td><p>Reset the digital I/O to the default configuration.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_dio_input_read_bit" title="mcc152_dio_input_read_bit"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_input_read_bit()</span></code></a></p></td>
<td><p>Read a digital input.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_input_read_port" title="mcc152_dio_input_read_port"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_input_read_port()</span></code></a></p></td>
<td><p>Read all digital inputs.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_dio_output_write_bit" title="mcc152_dio_output_write_bit"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_output_write_bit()</span></code></a></p></td>
<td><p>Write a digital output.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_output_write_port" title="mcc152_dio_output_write_port"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_output_write_port()</span></code></a></p></td>
<td><p>Write all digital outputs.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_dio_output_read_bit" title="mcc152_dio_output_read_bit"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_output_read_bit()</span></code></a></p></td>
<td><p>Read the state of a digital output.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_output_read_port" title="mcc152_dio_output_read_port"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_output_read_port()</span></code></a></p></td>
<td><p>Read the state of all digital outputs.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_dio_int_status_read_bit" title="mcc152_dio_int_status_read_bit"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_int_status_read_bit()</span></code></a></p></td>
<td><p>Read the interrupt status for a single channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_int_status_read_port" title="mcc152_dio_int_status_read_port"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_int_status_read_port()</span></code></a></p></td>
<td><p>Read the interrupt status for all channels.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_dio_config_write_bit" title="mcc152_dio_config_write_bit"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_config_write_bit()</span></code></a></p></td>
<td><p>Write a digital I/O configuration item value for a single channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_config_write_port" title="mcc152_dio_config_write_port"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_config_write_port()</span></code></a></p></td>
<td><p>Write a digital I/O configuration item value for all channels.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc152_dio_config_read_bit" title="mcc152_dio_config_read_bit"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_config_read_bit()</span></code></a></p></td>
<td><p>Read a digital I/O configuration item value for a single channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc152_dio_config_read_port" title="mcc152_dio_config_read_port"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc152_dio_config_read_port()</span></code></a></p></td>
<td><p>Read a digital I/O configuration item value for all channels.</p></td>
</tr>
</tbody>
</table>
<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_open">
<span class="target" id="mcc152_8h_1a9beb81281964a9dfbaa98733d47fb55f"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_open" title="Link to this definition"></a><br /></dt>
<dd><p>Open a connection to the MCC 152 device at the specified address. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_is_open">
<span class="target" id="mcc152_8h_1a1b5668b0c88ec78d51798c5aec4ce523"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_is_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_is_open" title="Link to this definition"></a><br /></dt>
<dd><p>Check if an MCC 152 is open. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>1 if open, 0 if not open. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_close">
<span class="target" id="mcc152_8h_1abc84c533e2f4e10c09bb39458d02d088"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_close</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_close" title="Link to this definition"></a><br /></dt>
<dd><p>Close a connection to an MCC 152 device and free allocated resources. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_info">
<span class="target" id="mcc152_8h_1a5c9670b2f59085dc4ac8670723dcbc6e"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.MCC152DeviceInfo" title="MCC152DeviceInfo"><span class="n"><span class="pre">MCC152DeviceInfo</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_info</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_info" title="Link to this definition"></a><br /></dt>
<dd><p>Return constant device information for all MCC 152s. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Pointer to struct <a class="reference internal" href="#structMCC152DeviceInfo"><span class="std std-ref">MCC152DeviceInfo</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_serial">
<span class="target" id="mcc152_8h_1a53694430a26d207821867d6f9b6f96db"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_serial</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_serial" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 152 serial number. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the serial number as a string. The buffer must be at least 9 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_a_out_write">
<span class="target" id="mcc152_8h_1a148b13185ab2b14827f21b4a02aa72a9"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_a_out_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_a_out_write" title="Link to this definition"></a><br /></dt>
<dd><p>Perform a write to an analog output channel. </p>
<p>Updates the analog output channel in either volts or DAC code (set the <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> option to use DAC code.) The voltage must be 0.0 - 5.0 and DAC code 0.0 - 4095.0.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The analog output channel number, 0 - 1. </p></li>
<li><p><strong>options</strong> – Options bitmask </p></li>
<li><p><strong>value</strong> – The analog output value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_a_out_write_all">
<span class="target" id="mcc152_8h_1ada34c9f0fd3eb8368cf65423d5f65a37"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_a_out_write_all</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">values</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_a_out_write_all" title="Link to this definition"></a><br /></dt>
<dd><p>Perform a write to all analog output channels simultaneously. </p>
<p>Update all analog output channels in either volts or DAC code (set the <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> option to use DAC code.) The outputs will update at the same time.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>options</strong> – Options bitmask </p></li>
<li><p><strong>values</strong> – The array of analog output values; there must be at least 2 values, but only the first two values will be used. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_reset">
<span class="target" id="mcc152_8h_1a92d0150691f052f60d5a31152da21b2f"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_reset</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_reset" title="Link to this definition"></a><br /></dt>
<dd><p>Reset the digital I/O to the default configuration. </p>
<p><ul class="simple">
<li><p>All channels input</p></li>
<li><p>Output registers set to 1</p></li>
<li><p>Input inversion disabled</p></li>
<li><p>No input latching</p></li>
<li><p>Pull-up resistors enabled</p></li>
<li><p>All interrupts disabled</p></li>
<li><p>Push-pull output type</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_input_read_bit">
<span class="target" id="mcc152_8h_1ad5ded094a3e12cd384190982440e21f9"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_input_read_bit</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_input_read_bit" title="Link to this definition"></a><br /></dt>
<dd><p>Read a single digital input channel. </p>
<p>Returns 0 or 1 in <strong>value</strong>. If the specified channel is configured as an output this will return the value present at the terminal.</p>
<p>This function reads the entire input register, so care must be taken when latched inputs are enabled. If a latched input changes between input reads then changes back to its original value, the next input read will report the change to the first value then the following read will show the original value. If another input is read then this input change could be missed so it is best to use <a class="reference internal" href="#mcc152_8h_1adfd860138b00227da22e9ceb3a09233b"><span class="std std-ref">mcc152_dio_input_read_port()</span></a> when using latched inputs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The DIO channel number, 0 - 7. </p></li>
<li><p><strong>value</strong> – Receives the input value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_input_read_port">
<span class="target" id="mcc152_8h_1adfd860138b00227da22e9ceb3a09233b"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_input_read_port</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_input_read_port" title="Link to this definition"></a><br /></dt>
<dd><p>Read all digital input channels simultaneously. </p>
<p>Returns an 8-bit value in <strong>value</strong> representing all channels in channel order (bit 0 is channel 0, etc.) If a channel is configured as an output this will return the value present at the terminal.</p>
<p>Care must be taken when latched inputs are enabled. If a latched input changes between input reads then changes back to its original value, the next input read will report the change to the first value then the following read will show the original value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>value</strong> – Receives the input values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_output_write_bit">
<span class="target" id="mcc152_8h_1a09673f08071eb3c102377921a09dad5a"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_output_write_bit</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_output_write_bit" title="Link to this definition"></a><br /></dt>
<dd><p>Write a single digital output channel. </p>
<p>If the specified channel is configured as an input this will not have any effect at the terminal, but allows the output register to be loaded before configuring the channel as an output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The DIO channel number, 0 - 7. </p></li>
<li><p><strong>value</strong> – The output value (0 or 1) </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_output_write_port">
<span class="target" id="mcc152_8h_1ab1aa3bac808bab1d3fd81c36a73b6231"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_output_write_port</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_output_write_port" title="Link to this definition"></a><br /></dt>
<dd><p>Write all digital output channels simultaneously. </p>
<p>Pass an 8-bit value in <strong>value</strong> representing the desired output for all channels in channel order (bit 0 is channel 0, etc.)</p>
<p>If the specified channel is configured as an input this will not have any effect at the terminal, but allows the output register to be loaded before configuring the channel as an output.</p>
<p>For example, to set channels 0 - 3 to 0 and channels 4 - 7 to 1 call: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mcc152_dio_output_write</span><span class="p">(</span><span class="n">address</span><span class="p">,</span> <span class="mh">0xF0</span><span class="p">);</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>value</strong> – The output values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_output_read_bit">
<span class="target" id="mcc152_8h_1ad6c1ed3728e63dfa144446797d52e387"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_output_read_bit</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_output_read_bit" title="Link to this definition"></a><br /></dt>
<dd><p>Read a single digital output register. </p>
<p>Returns 0 or 1 in <strong>value</strong>.</p>
<p>This function returns the value stored in the output register. It may not represent the value at the terminal if the channel is configured as input or open-drain output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The DIO channel number, 0 - 7. </p></li>
<li><p><strong>value</strong> – Receives the output value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_output_read_port">
<span class="target" id="mcc152_8h_1a4f76b8c99e0397990553dc832023686f"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_output_read_port</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_output_read_port" title="Link to this definition"></a><br /></dt>
<dd><p>Read all digital output registers simultaneously. </p>
<p>Returns an 8-bit value in <strong>value</strong> representing all channels in channel order (bit 0 is channel 0, etc.)</p>
<p>This function returns the value stored in the output register. It may not represent the value at the terminal if the channel is configured as input or open-drain output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>value</strong> – Receives the output values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_int_status_read_bit">
<span class="target" id="mcc152_8h_1ae95e8ac5712f88bd2bd8a7ce70b619b9"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_int_status_read_bit</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_int_status_read_bit" title="Link to this definition"></a><br /></dt>
<dd><p>Read the interrupt status for a single channel. </p>
<p>Returns 0 when the channel is not generating an interrupt, 1 when the channel is generating an interrupt.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The DIO channel number, 0 - 7. </p></li>
<li><p><strong>value</strong> – Receives the interrupt status value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_int_status_read_port">
<span class="target" id="mcc152_8h_1a5869de01d0a516ea8589cba5057f78d5"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_int_status_read_port</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_int_status_read_port" title="Link to this definition"></a><br /></dt>
<dd><p>Read the interrupt status for all channels. </p>
<p>Returns an 8-bit value in <strong>value</strong> representing all channels in channel order (bit 0 is channel 0, etc.) A 0 in a bit indicates the corresponding channel is not generating an interrupt, a 1 indicates the channel is generating an interrupt.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>value</strong> – Receives the interrupt status value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_config_write_bit">
<span class="target" id="mcc152_8h_1ae51075376f792b198f475b2deb5623de"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_config_write_bit</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">item</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_config_write_bit" title="Link to this definition"></a><br /></dt>
<dd><p>Write a digital I/O configuration value for a single channel. </p>
<p>There are several configuration items that may be written for the digital I/O. The item is selected with the <strong>item</strong> argument, which may be one of the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a> values:<ul>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"><span class="std std-ref">DIO_DIRECTION</span></a>: Set the digital I/O channel direction by passing 0 for output and 1 for input.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"><span class="std std-ref">DIO_PULL_CONFIG</span></a>: Configure the pull-up/down resistor by passing 0 for pull-down or 1 for pull-up. The resistor may be enabled or disabled with the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"><span class="std std-ref">DIO_PULL_ENABLE</span></a> item.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"><span class="std std-ref">DIO_PULL_ENABLE</span></a>: Enable or disable the pull-up/down resistor by passing 0 for disabled or 1 for enabled. The resistor is configured for pull-up/down with the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"><span class="std std-ref">DIO_PULL_CONFIG</span></a> item. The resistor is automatically disabled if the bit is set to output and is configured as open-drain.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705af0dde18458c7df721797f051ec0c9f02"><span class="std std-ref">DIO_INPUT_INVERT</span></a>: Enable inverting the input by passing a 0 for normal input or 1 for inverted.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a81416db41ddc7568aea49cc6bbb0628d"><span class="std std-ref">DIO_INPUT_LATCH</span></a>: Enable input latching by passing 0 for non-latched or 1 for latched.</p>
<p>When the input is non-latched, reads show the current status of the input. A state change in the input generates an interrupt (if it is not masked). A read of the input clears the interrupt. If the input goes back to its initial logic state before the input is read, then the interrupt is cleared.</p>
<p>When the input is latched, a change of state of the input generates an interrupt and the input logic value is loaded into the input port register. A read of the input will clear the interrupt. If the input returns to its initial logic state before the input is read, then the interrupt is not cleared and the input register keeps the logic value that initiated the interrupt. The next read of the input will show the initial state. Care must be taken when using bit reads on the input when latching is enabled - the bit function still reads the entire input register so a change on another bit could be missed. It is best to use port input reads when using latching.</p>
<p>If the input is changed from latched to non-latched, a read from the input reflects the current terminal logic level. If the input is changed from non-latched to latched input, the read from the input represents the latched logic level.</p>
</li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705ad1ff805daab40a51dfde7a491ccd05f2"><span class="std std-ref">DIO_OUTPUT_TYPE</span></a>: Set the output type by writing 0 for push-pull or 1 for open-drain. This setting affects all outputs so is not a per-channel setting and the channel argument will be ignored. It should be set to the desired type before using the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"><span class="std std-ref">DIO_DIRECTION</span></a> item to set channels as outputs. Internal pull-up/down resistors are disabled when a bit is set to output and is configured as open-drain, so external resistors should be used.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a625a2602ff2fd8578ac8d247e07a1ab2"><span class="std std-ref">DIO_INT_MASK</span></a>: Enable or disable interrupt generation for the input by masking the interrupt. Write 0 to enable the interrupt or 1 to disable it.</p>
<p>All MCC 152s share a single interrupt signal to the CPU, so when an interrupt occurs the user must determine the source, optionally act on the interrupt, then clear that source so that other interrupts may be detected. The current interrupt state may be read with <a class="reference internal" href="#daqhats_8h_1a275955f80b2e8e67a896ac61bbca54a6"><span class="std std-ref">hat_interrupt_state()</span></a>. A user program may wait for the interrupt to become active with <a class="reference internal" href="#daqhats_8h_1a310c568b97d4e34e9534858b5b85602c"><span class="std std-ref">hat_wait_for_interrupt()</span></a>, or may register an interrrupt callback function with <a class="reference internal" href="#daqhats_8h_1a38121826f94ae6dd764c28a08f9c5969"><span class="std std-ref">hat_interrupt_callback_enable()</span></a>. This allows the user to wait for a change on one or more inputs without constantly reading the inputs. The source of the interrupt may be determined by reading the interrupt status of each MCC 152 with <a class="reference internal" href="#mcc152_8h_1ae95e8ac5712f88bd2bd8a7ce70b619b9"><span class="std std-ref">mcc152_dio_int_status_read_bit()</span></a> or <a class="reference internal" href="#mcc152_8h_1a5869de01d0a516ea8589cba5057f78d5"><span class="std std-ref">mcc152_dio_int_status_read_port()</span></a>, and all active interrupt sources must be cleared before the interrupt will become inactive. The interrupt is cleared by reading the input(s) with <a class="reference internal" href="#mcc152_8h_1ad5ded094a3e12cd384190982440e21f9"><span class="std std-ref">mcc152_dio_input_read_bit()</span></a> or <a class="reference internal" href="#mcc152_8h_1adfd860138b00227da22e9ceb3a09233b"><span class="std std-ref">mcc152_dio_input_read_port()</span></a>.</p>
</li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The digital I/O channel, 0 - 7. </p></li>
<li><p><strong>item</strong> – The config item, one of <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a>. </p></li>
<li><p><strong>value</strong> – The config value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_config_write_port">
<span class="target" id="mcc152_8h_1aaa119525f9720f2496f6af05492fd48a"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_config_write_port</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">item</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_config_write_port" title="Link to this definition"></a><br /></dt>
<dd><p>Write a digital I/O configuration value for all channels. </p>
<p>There are several configuration items that may be written for the digital I/O. They are written for all channels at once using the 8-bit value passed in <strong>value</strong>, where each bit corresponds to a channel (bit 0 is channel 0, etc.) The item is selected with the <strong>item</strong> argument, which may be one of the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a> values:<ul>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"><span class="std std-ref">DIO_DIRECTION</span></a>: Set the digital I/O channel directions by passing 0 in a bit for output and 1 for input.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"><span class="std std-ref">DIO_PULL_CONFIG</span></a>: Configure the pull-up/down resistors by passing 0 in a bit for pull-down or 1 for pull-up. The resistors may be enabled or disabled with the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"><span class="std std-ref">DIO_PULL_ENABLE</span></a> item.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"><span class="std std-ref">DIO_PULL_ENABLE</span></a>: Enable or disable pull-up/down resistors by passing 0 in a bit for disabled or 1 for enabled. The resistors are configured for pull-up/down with the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"><span class="std std-ref">DIO_PULL_CONFIG</span></a> item. The resistors are automatically disabled if a bit is set to output and is configured as open-drain.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705af0dde18458c7df721797f051ec0c9f02"><span class="std std-ref">DIO_INPUT_INVERT</span></a>: Enable inverting inputs by passing a 0 in a bit for normal input or 1 for inverted.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a81416db41ddc7568aea49cc6bbb0628d"><span class="std std-ref">DIO_INPUT_LATCH</span></a>: Enable input latching by passing 0 in a bit for non-latched or 1 for latched.</p>
<p>When the input is non-latched, reads show the current status of the input. A state change in the corresponding input generates an interrupt (if it is not masked). A read of the input clears the interrupt. If the input goes back to its initial logic state before the input is read, then the interrupt is cleared.</p>
<p>When the input is latched, a change of state of the input generates an interrupt and the input logic value is loaded into the input port register. A read of the input will clear the interrupt. If the input returns to its initial logic state before the input is read, then the interrupt is not cleared and the input register keeps the logic value that initiated the interrupt. The next read of the input will show the initial state. Care must be taken when using bit reads on the input when latching is enabled - the bit function still reads the entire input register so a change on another bit could be missed. It is best to use port input reads when using latching.</p>
<p>If the input is changed from latched to non-latched, a read from the input reflects the current terminal logic level. If the input is changed from non-latched to latched input, the read from the input represents the latched logic level.</p>
</li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705ad1ff805daab40a51dfde7a491ccd05f2"><span class="std std-ref">DIO_OUTPUT_TYPE</span></a>: Set the output type by writing 0 for push-pull or 1 for open-drain. This setting affects all outputs so is not a per-channel setting. It should be set to the desired type before using <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"><span class="std std-ref">DIO_DIRECTION</span></a> to set channels as outputs. Internal pull-up/down resistors are disabled when a bit is set to output and is configured as open-drain, so external resistors should be used.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a625a2602ff2fd8578ac8d247e07a1ab2"><span class="std std-ref">DIO_INT_MASK</span></a>: Enable or disable interrupt generation for specific inputs by masking the interrupts. Write 0 in a bit to enable the interrupt from that channel or 1 to disable it.</p>
<p>All MCC 152s share a single interrupt signal to the CPU, so when an interrupt occurs the user must determine the source, optionally act on the interrupt, then clear that source so that other interrupts may be detected. The current interrupt state may be read with <a class="reference internal" href="#daqhats_8h_1a275955f80b2e8e67a896ac61bbca54a6"><span class="std std-ref">hat_interrupt_state()</span></a>. A user program may wait for the interrupt to become active with <a class="reference internal" href="#daqhats_8h_1a310c568b97d4e34e9534858b5b85602c"><span class="std std-ref">hat_wait_for_interrupt()</span></a>, or may register an interrrupt callback function with <a class="reference internal" href="#daqhats_8h_1a38121826f94ae6dd764c28a08f9c5969"><span class="std std-ref">hat_interrupt_callback_enable()</span></a>. This allows the user to wait for a change on one or more inputs without constantly reading the inputs. The source of the interrupt may be determined by reading the interrupt status of each MCC 152 with <a class="reference internal" href="#mcc152_8h_1ae95e8ac5712f88bd2bd8a7ce70b619b9"><span class="std std-ref">mcc152_dio_int_status_read_bit()</span></a> or <a class="reference internal" href="#mcc152_8h_1a5869de01d0a516ea8589cba5057f78d5"><span class="std std-ref">mcc152_dio_int_status_read_port()</span></a>, and all active interrupt sources must be cleared before the interrupt will become inactive. The interrupt is cleared by reading the input(s) with <a class="reference internal" href="#mcc152_8h_1ad5ded094a3e12cd384190982440e21f9"><span class="std std-ref">mcc152_dio_input_read_bit()</span></a> or <a class="reference internal" href="#mcc152_8h_1adfd860138b00227da22e9ceb3a09233b"><span class="std std-ref">mcc152_dio_input_read_port()</span></a>.</p>
</li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>item</strong> – The config item, one of <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a>. </p></li>
<li><p><strong>value</strong> – The config value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_config_read_bit">
<span class="target" id="mcc152_8h_1ad423ad393b61af0aba34675adfc2904a"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_config_read_bit</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">item</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_config_read_bit" title="Link to this definition"></a><br /></dt>
<dd><p>Read a digital I/O configuration value for a single channel. </p>
<p>There are several configuration items that may be read for the digital I/O. The item is selected with the <strong>item</strong> argument, which may be one of the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a> values:<ul class="simple">
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"><span class="std std-ref">DIO_DIRECTION</span></a>: Read the digital I/O channel direction setting, where 0 is output and 1 is input.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"><span class="std std-ref">DIO_PULL_CONFIG</span></a>: Read the pull-up/down resistor configuration where 0 is pull-down and 1 is pull-up.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"><span class="std std-ref">DIO_PULL_ENABLE</span></a>: Read the pull-up/down resistor enable setting where 0 is disabled and 1 is enabled.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705af0dde18458c7df721797f051ec0c9f02"><span class="std std-ref">DIO_INPUT_INVERT</span></a>: Read the input invert setting where 0 is normal input and 1 is inverted.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a81416db41ddc7568aea49cc6bbb0628d"><span class="std std-ref">DIO_INPUT_LATCH</span></a>: Read the input latching setting where 0 is non-latched and 1 is latched.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705ad1ff805daab40a51dfde7a491ccd05f2"><span class="std std-ref">DIO_OUTPUT_TYPE</span></a>: Read the output type setting where 0 is push-pull and 1 is open-drain. This setting affects all outputs so is not a per-channel setting and the channel argument is ignored.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a625a2602ff2fd8578ac8d247e07a1ab2"><span class="std std-ref">DIO_INT_MASK</span></a>: Read the interrupt mask setting where 0 enables the interrupt and 1 disables it.</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The digital I/O channel, 0 - 7. </p></li>
<li><p><strong>item</strong> – The config item, one of <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a>. </p></li>
<li><p><strong>value</strong> – Receives the config value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc152_dio_config_read_port">
<span class="target" id="mcc152_8h_1a14dca68b282121b83c019d39cea1e7d5"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc152_dio_config_read_port</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">item</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc152_dio_config_read_port" title="Link to this definition"></a><br /></dt>
<dd><p>Read a digital I/O configuration value for all channels. </p>
<p>There are several configuration items that may be read for the digital I/O. They are read for all channels at once, returning an 8-bit value in <strong>value</strong>, where each bit corresponds to a channel (bit 0 is channel 0, etc.) The item is selected with the <strong>item</strong> argument, which may be one of the <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a> values:<ul class="simple">
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"><span class="std std-ref">DIO_DIRECTION</span></a>: Read the digital I/O channels direction settings, where 0 for a bit is output and 1 is input.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"><span class="std std-ref">DIO_PULL_CONFIG</span></a>: Read the pull-up/down resistor configurations where 0 for a bit is pull-down and 1 is pull-up.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"><span class="std std-ref">DIO_PULL_ENABLE</span></a>: Read the pull-up/down resistor enable settings where 0 for a bit is disabled and 1 is enabled.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705af0dde18458c7df721797f051ec0c9f02"><span class="std std-ref">DIO_INPUT_INVERT</span></a>: Read the input invert settings where 0 for a bit is normal input and 1 is inverted.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a81416db41ddc7568aea49cc6bbb0628d"><span class="std std-ref">DIO_INPUT_LATCH</span></a>: Read the input latching settings where 0 for a bit is non-latched and 1 is latched.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705ad1ff805daab40a51dfde7a491ccd05f2"><span class="std std-ref">DIO_OUTPUT_TYPE</span></a>: Read the output type setting where 0 is push-pull and 1 is open-drain. This setting affects all outputs so is not a per-channel setting.</p></li>
<li><p><a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705a625a2602ff2fd8578ac8d247e07a1ab2"><span class="std std-ref">DIO_INT_MASK</span></a>: Read the interrupt mask settings where 0 enables the interrupt from the corresponding channel and 1 disables it.</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>item</strong> – The config item, one of <a class="reference internal" href="#mcc152_8h_1a7204ac46141530f835f15695b3704705"><span class="std std-ref">DIOConfigItem</span></a>. </p></li>
<li><p><strong>value</strong> – Receives the config value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

</section>
<section id="id9">
<h3>Data types and definitions<a class="headerlink" href="#id9" title="Link to this heading"></a></h3>
<section id="id10">
<h4>Device Info<a class="headerlink" href="#id10" title="Link to this heading"></a></h4>
<dl class="c struct">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo">
<span class="target" id="structMCC152DeviceInfo"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MCC152DeviceInfo</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 152 constant device information. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.NUM_DIO_CHANNELS">
<span class="target" id="structMCC152DeviceInfo_1a89f5e18085f15c448a09094b0c84739e"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_DIO_CHANNELS</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.NUM_DIO_CHANNELS" title="Link to this definition"></a><br /></dt>
<dd><p>The number of digital I/O channels (8.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.NUM_AO_CHANNELS">
<span class="target" id="structMCC152DeviceInfo_1a45a2432aed75e9014c4e40d9bcf25fda"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AO_CHANNELS</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.NUM_AO_CHANNELS" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog output channels (2.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.AO_MIN_CODE">
<span class="target" id="structMCC152DeviceInfo_1a5f6530deb5d7feca7b0b98b29dbc279d"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AO_MIN_CODE</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.AO_MIN_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum DAC code (0.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.AO_MAX_CODE">
<span class="target" id="structMCC152DeviceInfo_1ad22bf778d5884dc3b4cf83632d622cec"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AO_MAX_CODE</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.AO_MAX_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum DAC code (4095.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.AO_MIN_VOLTAGE">
<span class="target" id="structMCC152DeviceInfo_1a43382cc26fbccfcb6ad9bfd0c9bdb3a9"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AO_MIN_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.AO_MIN_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The output voltage corresponding to the minimum code (0.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.AO_MAX_VOLTAGE">
<span class="target" id="structMCC152DeviceInfo_1a6cc138828930e43cee7cc1f1087a8ed4"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AO_MAX_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.AO_MAX_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The output voltage corresponding to the maximum code (+5.0V - 1 LSB.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.AO_MIN_RANGE">
<span class="target" id="structMCC152DeviceInfo_1a8f19ba59db0c953834db50a785bb773a"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AO_MIN_RANGE</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.AO_MIN_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum voltage of the output range (0.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC152DeviceInfo.AO_MAX_RANGE">
<span class="target" id="structMCC152DeviceInfo_1a38395cf9d61dcc4bde34403403a7cbb5"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AO_MAX_RANGE</span></span></span><a class="headerlink" href="#c.MCC152DeviceInfo.AO_MAX_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum voltage of the output range (+5.0V.) </p>
</dd></dl>

</div>
</dd></dl>

</section>
<section id="dio-config-items">
<h4>DIO Config Items<a class="headerlink" href="#dio-config-items" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.DIOConfigItem">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIOConfigItem</span></span></span><a class="headerlink" href="#c.DIOConfigItem" title="Link to this definition"></a><br /></dt>
<dd><p>DIO Configuration Items. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_DIRECTION">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705a3ba75deb838d37da42496c045726e494"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_DIRECTION</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_DIRECTION" title="Link to this definition"></a><br /></dt>
<dd><p>Configure channel direction. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_PULL_CONFIG">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705a1a5814490dc2a97e068d524926765ca0"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_PULL_CONFIG</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_PULL_CONFIG" title="Link to this definition"></a><br /></dt>
<dd><p>Configure pull-up/down resistor. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_PULL_ENABLE">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705a59e0108fd17e2c1c7d3b7f972f998579"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_PULL_ENABLE</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_PULL_ENABLE" title="Link to this definition"></a><br /></dt>
<dd><p>Enable pull-up/down resistor. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_INPUT_INVERT">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705af0dde18458c7df721797f051ec0c9f02"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_INPUT_INVERT</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_INPUT_INVERT" title="Link to this definition"></a><br /></dt>
<dd><p>Configure input inversion. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_INPUT_LATCH">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705a81416db41ddc7568aea49cc6bbb0628d"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_INPUT_LATCH</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_INPUT_LATCH" title="Link to this definition"></a><br /></dt>
<dd><p>Configure input latching. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_OUTPUT_TYPE">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705ad1ff805daab40a51dfde7a491ccd05f2"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_OUTPUT_TYPE</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_OUTPUT_TYPE" title="Link to this definition"></a><br /></dt>
<dd><p>Configure output type. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.DIOConfigItem.DIO_INT_MASK">
<span class="target" id="mcc152_8h_1a7204ac46141530f835f15695b3704705a625a2602ff2fd8578ac8d247e07a1ab2"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">DIO_INT_MASK</span></span></span><a class="headerlink" href="#c.DIOConfigItem.DIO_INT_MASK" title="Link to this definition"></a><br /></dt>
<dd><p>Configure interrupt mask. </p>
</dd></dl>

</dd></dl>

</section>
</section>
</section>
<section id="mcc-172-functions-and-data">
<h2>MCC 172 functions and data<a class="headerlink" href="#mcc-172-functions-and-data" title="Link to this heading"></a></h2>
<section id="id11">
<h3>Functions<a class="headerlink" href="#id11" title="Link to this heading"></a></h3>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>Function</p></td>
<td><p>Description</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_open" title="mcc172_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_open()</span></code></a></p></td>
<td><p>Open an MCC 172 for use.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_is_open" title="mcc172_is_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_is_open()</span></code></a></p></td>
<td><p>Check if an MCC 172 is open.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_close" title="mcc172_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_close()</span></code></a></p></td>
<td><p>Close an MCC 172.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_info" title="mcc172_info"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_info()</span></code></a></p></td>
<td><p>Return information about this device type.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_blink_led" title="mcc172_blink_led"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_blink_led()</span></code></a></p></td>
<td><p>Blink the MCC 172 LED.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_firmware_version" title="mcc172_firmware_version"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_firmware_version()</span></code></a></p></td>
<td><p>Get the firmware version.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_serial" title="mcc172_serial"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_serial()</span></code></a></p></td>
<td><p>Read the serial number.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_calibration_date" title="mcc172_calibration_date"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_calibration_date()</span></code></a></p></td>
<td><p>Read the calibration date.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_calibration_coefficient_read" title="mcc172_calibration_coefficient_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_calibration_coefficient_read()</span></code></a></p></td>
<td><p>Read the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_calibration_coefficient_write" title="mcc172_calibration_coefficient_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_calibration_coefficient_write()</span></code></a></p></td>
<td><p>Write the calibration coefficients for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_iepe_config_read" title="mcc172_iepe_config_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_iepe_config_read()</span></code></a></p></td>
<td><p>Read the IEPE configuration for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_iepe_config_write" title="mcc172_iepe_config_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_iepe_config_write()</span></code></a></p></td>
<td><p>Write the IEPE configuration for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_a_in_sensitivity_read" title="mcc172_a_in_sensitivity_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_sensitivity_read()</span></code></a></p></td>
<td><p>Read the sensitivity scaling for a channel.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_a_in_sensitivity_write" title="mcc172_a_in_sensitivity_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_sensitivity_write()</span></code></a></p></td>
<td><p>Write the sensitivity scaling for a channel.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_a_in_clock_config_read" title="mcc172_a_in_clock_config_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_clock_config_read()</span></code></a></p></td>
<td><p>Read the sampling clock configuration.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_a_in_clock_config_write" title="mcc172_a_in_clock_config_write"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_clock_config_write()</span></code></a></p></td>
<td><p>Write the sampling clock configuration.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_trigger_config" title="mcc172_trigger_config"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_trigger_config()</span></code></a></p></td>
<td><p>Configure the external trigger input.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_start" title="mcc172_a_in_scan_start"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_start()</span></code></a></p></td>
<td><p>Start a hardware-paced analog input scan.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_buffer_size" title="mcc172_a_in_scan_buffer_size"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_buffer_size()</span></code></a></p></td>
<td><p>Read the size of the internal scan data buffer.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_status" title="mcc172_a_in_scan_status"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_status()</span></code></a></p></td>
<td><p>Read the scan status.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_read" title="mcc172_a_in_scan_read"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_read()</span></code></a></p></td>
<td><p>Read scan data and status.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_channel_count" title="mcc172_a_in_scan_channel_count"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_channel_count()</span></code></a></p></td>
<td><p>Get the number of channels in the current scan.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_stop" title="mcc172_a_in_scan_stop"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_stop()</span></code></a></p></td>
<td><p>Stop the scan.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#c.mcc172_a_in_scan_cleanup" title="mcc172_a_in_scan_cleanup"><code class="xref c c-func docutils literal notranslate"><span class="pre">mcc172_a_in_scan_cleanup()</span></code></a></p></td>
<td><p>Free scan resources.</p></td>
</tr>
</tbody>
</table>
<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_open">
<span class="target" id="mcc172_8h_1a36f5dc6c84a68aef20a4d59de0c6f266"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_open" title="Link to this definition"></a><br /></dt>
<dd><p>Open a connection to the MCC 172 device at the specified address. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_close">
<span class="target" id="mcc172_8h_1a3bec3648d346641a836e631f2c8392fe"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_close</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_close" title="Link to this definition"></a><br /></dt>
<dd><p>Close a connection to an MCC 172 device and free allocated resources. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_is_open">
<span class="target" id="mcc172_8h_1a59b1a57e6d6b7e8593a326e7dd8697a3"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_is_open</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_is_open" title="Link to this definition"></a><br /></dt>
<dd><p>Check if an MCC 172 is open. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>1 if open, 0 if not open. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_info">
<span class="target" id="mcc172_8h_1ac8f3e0b1afb4fe64b89f9883de559a0c"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.MCC172DeviceInfo" title="MCC172DeviceInfo"><span class="n"><span class="pre">MCC172DeviceInfo</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_info</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_info" title="Link to this definition"></a><br /></dt>
<dd><p>Return constant device information for all MCC 172s. </p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Pointer to struct <a class="reference internal" href="#structMCC172DeviceInfo"><span class="std std-ref">MCC172DeviceInfo</span></a>. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_blink_led">
<span class="target" id="mcc172_8h_1a006925c4178ef5825f4c2871741ab692"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_blink_led</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">count</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_blink_led" title="Link to this definition"></a><br /></dt>
<dd><p>Blink the LED on the MCC 172. </p>
<p>Passing 0 for count will result in the LED blinking continuously until the board is reset or <a class="reference internal" href="#mcc172_8h_1a006925c4178ef5825f4c2871741ab692"><span class="std std-ref">mcc172_blink_led()</span></a> is called again with a non-zero value for count.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). </p></li>
<li><p><strong>count</strong> – The number of times to blink (0 - 255). </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_firmware_version">
<span class="target" id="mcc172_8h_1a979a343501c79864a483dfa18a32c65e"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_firmware_version</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">version</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_firmware_version" title="Link to this definition"></a><br /></dt>
<dd><p>Return the board firmware version. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>version</strong> – Receives the firmware version. The version will be in BCD hexadecimal with the high byte as the major version and low byte as minor, i.e. 0x0103 is version 1.03. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_serial">
<span class="target" id="mcc172_8h_1a8a29e98f6242957da0e30b22ead29cc1"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_serial</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_serial" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 172 serial number. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the serial number as a string. The buffer must be at least 9 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_calibration_date">
<span class="target" id="mcc172_8h_1acbd099e762aebcfa0bfa3f0f93175e8a"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_calibration_date</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_calibration_date" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 172 calibration date. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer</strong> – Pass a user-allocated buffer pointer to receive the date as a string (format “YYYY-MM-DD”). The buffer must be at least 11 characters in length. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_calibration_coefficient_read">
<span class="target" id="mcc172_8h_1ad7139fa34c3d29702039773ad2536e69"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_calibration_coefficient_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_calibration_coefficient_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 172 calibration coefficients for a single channel. </p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">-</span> <span class="n">offset</span><span class="p">)</span> <span class="o">*</span> <span class="n">slope</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 1). </p></li>
<li><p><strong>slope</strong> – Receives the slope. </p></li>
<li><p><strong>offset</strong> – Receives the offset. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_calibration_coefficient_write">
<span class="target" id="mcc172_8h_1a656cf92d46138471aef464b1f8708a28"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_calibration_coefficient_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">slope</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">offset</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_calibration_coefficient_write" title="Link to this definition"></a><br /></dt>
<dd><p>Temporarily write the MCC 172 calibration coefficients for a single channel. </p>
<p>The user can apply their own calibration coefficients by writing to these values. The values will reset to the factory values from the EEPROM whenever <a class="reference internal" href="#mcc172_8h_1a36f5dc6c84a68aef20a4d59de0c6f266"><span class="std std-ref">mcc172_open()</span></a> is called. This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<p>The coefficients are applied in the library as: <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">-</span> <span class="n">offset</span><span class="p">)</span> <span class="o">*</span> <span class="n">slope</span>
</pre></div>
</div>
 </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 1). </p></li>
<li><p><strong>slope</strong> – The new slope value. </p></li>
<li><p><strong>offset</strong> – The new offset value. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_iepe_config_read">
<span class="target" id="mcc172_8h_1a95e13e814298249bee047ceba577e9ca"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_iepe_config_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">config</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_iepe_config_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 172 IEPE configuration for a single channel. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 1). </p></li>
<li><p><strong>config</strong> – Receives the configuration for the specified channel:<ul>
<li><p>0: IEPE power off</p></li>
<li><p>1: IEPE power on </p></li>
</ul>
</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_iepe_config_write">
<span class="target" id="mcc172_8h_1a24b6b2a8ca69c08b42f7b31269bb84e3"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_iepe_config_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">config</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_iepe_config_write" title="Link to this definition"></a><br /></dt>
<dd><p>Write the MCC 172 IEPE configuration for a single channel. </p>
<p>Writes the new IEPE configuration for a channel. This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 1). </p></li>
<li><p><strong>config</strong> – The IEPE configuration for the specified channel:<ul>
<li><p>0: IEPE power off</p></li>
<li><p>1: IEPE power on </p></li>
</ul>
</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_sensitivity_read">
<span class="target" id="mcc172_8h_1acb0c58072c6a81e0cc26fc2e99ac54b6"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_sensitivity_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_sensitivity_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the MCC 172 analog input sensitivity scaling factor for a single channel. </p>
<p>The sensitivity is specified in mV / mechanical unit. The default value when opening the library is 1000, resulting in no scaling of the input voltage.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 1). </p></li>
<li><p><strong>value</strong> – Receives the sensitivity for the specified channel </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_sensitivity_write">
<span class="target" id="mcc172_8h_1a38c5fd4b8a7be4e7053dd340d6fb8412"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_sensitivity_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_sensitivity_write" title="Link to this definition"></a><br /></dt>
<dd><p>Write the MCC 172 analog input sensitivity scaling factor for a single channel. </p>
<p>This applies a scaling factor to the analog input data so it returns values that are meaningful for the connected sensor.</p>
<p>The sensitivity is specified in mV / mechanical unit. The default value when opening the library is 1000, resulting in no scaling of the input voltage. Changing this value will not change the values reported by <a class="reference internal" href="#mcc172_8h_1ac8f3e0b1afb4fe64b89f9883de559a0c"><span class="std std-ref">mcc172_info()</span></a> since it is simply sensor scaling applied to the data before returning it.</p>
<p>Examples:</p>
<p><ul class="simple">
<li><p>A seismic sensor with a sensitivity of 10 V/g. Set the sensitivity to 10,000 and the returned data will be in units of g.</p></li>
<li><p>A vibration sensor with a sensitivity of 100 mV/g. Set the sensitivity to 100 and the returned data will be in units of g.</p></li>
</ul>
</p>
<p>This function will fail and return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is active when it is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel</strong> – The channel number (0 - 1). </p></li>
<li><p><strong>value</strong> – The sensitivity for the specified channel. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_clock_config_read">
<span class="target" id="mcc172_8h_1a72040179e9edd47cf94addf821a27720"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_clock_config_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">clock_source</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sample_rate_per_channel</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">synced</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_clock_config_read" title="Link to this definition"></a><br /></dt>
<dd><p>Read the sampling clock configuration. </p>
<p>This function will return the sample clock configuration and rate. If the clock is configured for local or master source, then the rate will be the internally adjusted rate set by the user. If the clock is configured for slave source, then the rate will be measured from the master clock after the synchronization period has ended. The synchronization status is also returned.</p>
<p>The clock source will be one of the following values:</p>
<p><ul class="simple">
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1af3e14d0513d3544e7a53e6b391b591d1"><span class="std std-ref">SOURCE_LOCAL</span></a>: The clock is generated on this MCC 172 and not shared with other MCC 172s.</p></li>
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a09141537ae750f5a10118f36b95b6633"><span class="std std-ref">SOURCE_MASTER</span></a>: The clock is generated on this MCC 172 and is shared as the master clock for other MCC 172s.</p></li>
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a6bbbe701eb16b191dfb6e3b3c42c7f9e"><span class="std std-ref">SOURCE_SLAVE</span></a>: No clock is generated on this MCC 172, it receives its clock from the master MCC 172.</p></li>
</ul>
</p>
<p>The data rate will not be valid in slave mode if synced is equal to 0. The device will not detect a loss of the master clock when in slave mode; it only monitors the clock when a sync is initiated.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>clock_source</strong> – Receives the ADC clock source, one of the <a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1"><span class="std std-ref">source type</span></a> values. </p></li>
<li><p><strong>sample_rate_per_channel</strong> – Receives the sample rate in samples per second per channel </p></li>
<li><p><strong>synced</strong> – Receives the syncronization status (0: sync in progress, 1: sync complete) </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_clock_config_write">
<span class="target" id="mcc172_8h_1a7bd943e975298f3ee694c2ccea682386"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_clock_config_write</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">clock_source</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">sample_rate_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_clock_config_write" title="Link to this definition"></a><br /></dt>
<dd><p>Write the sampling clock configuration. </p>
<p>This function will configure the ADC sampling clock. The default configuration after opening the device is local mode, 51.2 KHz data rate.</p>
<p>The clock_source must be one of:</p>
<p><ul class="simple">
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1af3e14d0513d3544e7a53e6b391b591d1"><span class="std std-ref">SOURCE_LOCAL</span></a>: The clock is generated on this MCC 172 and not shared with other MCC 172s.</p></li>
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a09141537ae750f5a10118f36b95b6633"><span class="std std-ref">SOURCE_MASTER</span></a>: The clock is generated on this MCC 172 and is shared as the master clock for other MCC 172s. All other MCC 172s must be configured for local or slave clock.</p></li>
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a6bbbe701eb16b191dfb6e3b3c42c7f9e"><span class="std std-ref">SOURCE_SLAVE</span></a>: No clock is generated on this MCC 172, it receives its clock from the master MCC 172.</p></li>
</ul>
</p>
<p>The ADCs will be synchronized so they sample the inputs at the same time. This requires 128 clock cycles before the first sample is available. When using a master - slave clock configuration for multiple MCC 172s there are additional considerations:</p>
<p><ul class="simple">
<li><p>There should be only one master device; otherwise, you will be connecting multiple outputs together and could damage a device.</p></li>
<li><p>Configure the clock on the slave device(s) first, master last. The synchronization will occur when the master clock is configured, causing the ADCs on all the devices to be in sync.</p></li>
<li><p>If you change the clock configuration on one device after configuring the master, then the data will no longer be in sync. The devices cannot detect this and will still report that they are synchronized. Always write the clock configuration to all devices when modifying the configuration.</p></li>
<li><p>Slave devices must have a master clock source or scans will never complete.</p></li>
<li><p>A trigger must be used for the data streams from all devices to start on the same sample.</p></li>
</ul>
</p>
<p>The MCC 172 can generate an ADC sampling clock equal to 51.2 kHz divided by an integer between 1 and 256. The data_rate_per_channel will be internally converted to the nearest valid rate. The actual rate can be read back using <a class="reference internal" href="#mcc172_8h_1a72040179e9edd47cf94addf821a27720"><span class="std std-ref">mcc172_a_in_clock_config_read()</span></a>. When used in slave clock configuration, the device will measure the frequency of the incoming master clock after the synchronization period is complete. Calling <a class="reference internal" href="#mcc172_8h_1a72040179e9edd47cf94addf821a27720"><span class="std std-ref">mcc172_a_in_clock_config_read()</span></a> after this will return the measured data rate.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>clock_source</strong> – The ADC clock source, one of the <a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1"><span class="std std-ref">source type</span></a> values. </p></li>
<li><p><strong>sample_rate_per_channel</strong> – The requested sample rate in samples per second per channel </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_trigger_config">
<span class="target" id="mcc172_8h_1a46ab58e3b3b542c5fee59d9b1454fda2"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_trigger_config</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">source</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">mode</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_trigger_config" title="Link to this definition"></a><br /></dt>
<dd><p>Configure the digital trigger. </p>
<p>The analog input scan may be configured to start saving the acquired data when the digital trigger is in the desired state. A single device trigger may also be shared with multiple boards. This command sets the trigger source and mode.</p>
<p>The trigger source must be one of:</p>
<p><ul class="simple">
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1af3e14d0513d3544e7a53e6b391b591d1"><span class="std std-ref">SOURCE_LOCAL</span></a>: The trigger terminal on this MCC 172 is used and not shared with other MCC 172s.</p></li>
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a09141537ae750f5a10118f36b95b6633"><span class="std std-ref">SOURCE_MASTER</span></a>: The trigger terminal on this MCC 172 is used and is shared as the master trigger for other MCC 172s.</p></li>
<li><p><a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a6bbbe701eb16b191dfb6e3b3c42c7f9e"><span class="std std-ref">SOURCE_SLAVE</span></a>: The trigger terminal on this MCC 172 is not used, it receives its trigger from the master MCC 172.</p></li>
</ul>
</p>
<p>The trigger mode must be one of:</p>
<p><ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aa1df95eae49cc686aa6b9f91fa13c220b"><span class="std std-ref">TRIG_RISING_EDGE</span></a>: Start the scan on a rising edge of TRIG.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aaa008e9300e76a51f4c60fd9bf2ae5546"><span class="std std-ref">TRIG_FALLING_EDGE</span></a>: Start the scan on a falling edge of TRIG.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aa3f701a26940df0c263d230b753f61274"><span class="std std-ref">TRIG_ACTIVE_HIGH</span></a>: Start the scan any time TRIG is high.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94aa95176a26d99fad97d400764990a71c0b"><span class="std std-ref">TRIG_ACTIVE_LOW</span></a>: Start the scan any time TRIG is low.</p></li>
</ul>
</p>
<p>Due to the nature of the filtering in the A/D converters there is an input delay of 39 samples, so the data coming from the converters at any time is delayed by 39 samples from the current time. This is most noticeable when using a trigger - there will be approximately 39 samples prior to the trigger event in the captured data.</p>
<p>Care must be taken when using master / slave triggering; the input trigger signal on the master will be passed through to the slave(s), but the mode is set independently on each device. For example, it is possible for the master to trigger on the rising edge of the signal and the slave to trigger on the falling edge.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>source</strong> – The trigger source, one of the <a class="reference internal" href="#mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1"><span class="std std-ref">source type</span></a> values. </p></li>
<li><p><strong>mode</strong> – The trigger mode, one of the <a class="reference internal" href="#daqhats_8h_1aa534ed76b07c3983382a53e00e53e94a"><span class="std std-ref">trigger mode</span></a> values. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_start">
<span class="target" id="mcc172_8h_1aef1b8c4747b1c53413ab993db9ca85b5"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_start</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">channel_mask</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">samples_per_channel</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">options</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_start" title="Link to this definition"></a><br /></dt>
<dd><p>Start capturing analog input data from the specified channels. </p>
<p>The scan runs as a separate thread from the user’s code. The function will allocate a scan buffer and read data from the device into that buffer. The user reads the data from this buffer and the scan status using the <a class="reference internal" href="#mcc172_8h_1a99e9ef7bac1b4a3b48f0510cf1ef704f"><span class="std std-ref">mcc172_a_in_scan_read()</span></a> function. <a class="reference internal" href="#mcc172_8h_1a91b01737a38dfc59846414392f09352f"><span class="std std-ref">mcc172_a_in_scan_stop()</span></a> is used to stop a continuous scan, or to stop a finite scan before it completes. The user must call <a class="reference internal" href="#mcc172_8h_1a3c623caa4d914138eb3b8def0ecece2d"><span class="std std-ref">mcc172_a_in_scan_cleanup()</span></a> after the scan has finished and all desired data has been read; this frees all resources from the scan and allows additional scans to be performed.</p>
<p>The scan cannot be started until the ADCs are synchronized, so this function will not return until that has completed. It is best to wait for sync using <a class="reference internal" href="#mcc172_8h_1a72040179e9edd47cf94addf821a27720"><span class="std std-ref">mcc172_a_in_clock_config_read()</span></a> before starting the scan.</p>
<p>The scan state has defined terminology:<ul class="simple">
<li><p><strong>Active:</strong> <a class="reference internal" href="#mcc172_8h_1aef1b8c4747b1c53413ab993db9ca85b5"><span class="std std-ref">mcc172_a_in_scan_start()</span></a> has been called and the device may be acquiring data or finished with the acquisition. The scan has not been cleaned up by calling <a class="reference internal" href="#mcc172_8h_1a3c623caa4d914138eb3b8def0ecece2d"><span class="std std-ref">mcc172_a_in_scan_cleanup()</span></a>, so another scan may not be started.</p></li>
<li><p><strong>Running:</strong> The scan is active and the device is still acquiring data. Certain functions will return an error because the device is busy.</p></li>
</ul>
</p>
<p>The valid options are:<ul class="simple">
<li><p><a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a>: Returns ADC code (a value between AI_MIN_CODE and AI_MAX_CODE) rather than voltage.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a>: Return data without the calibration factors applied.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1aa2c6cc0f41865f0885ab83c6aa446dc1"><span class="std std-ref">OPTS_EXTTRIGGER</span></a>: Hold off the scan (after calling <a class="reference internal" href="#mcc172_8h_1aef1b8c4747b1c53413ab993db9ca85b5"><span class="std std-ref">mcc172_a_in_scan_start()</span></a>) until the trigger condition is met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1af34e1d3813b5909d7b8bf3012a2d829a"><span class="std std-ref">OPTS_CONTINUOUS</span></a>: Scans continuously until stopped by the user by calling <a class="reference internal" href="#mcc172_8h_1a91b01737a38dfc59846414392f09352f"><span class="std std-ref">mcc172_a_in_scan_stop()</span></a> and writes data to a circular buffer. The data must be read before being overwritten to avoid a buffer overrun error. <strong>samples_per_channel</strong> is only used for buffer sizing.</p></li>
</ul>
</p>
<p>The <a class="reference internal" href="#daqhats_8h_1a385c1e54c5caa4ddaab2bbed18a974a8"><span class="std std-ref">OPTS_EXTCLOCK</span></a> option is not supported for this device and will return an error.</p>
<p>The options parameter is set to 0 or <a class="reference internal" href="#daqhats_8h_1ac3262ea2b2658ce9d272e6b1246edd35"><span class="std std-ref">OPTS_DEFAULT</span></a> for default operation, which is scaled and calibrated data, no trigger, and finite operation.</p>
<p>Multiple options may be specified by ORing the flags. For instance, specifying <a class="reference internal" href="#daqhats_8h_1aca7ce40604d112dff98e0ce6f1194cbd"><span class="std std-ref">OPTS_NOSCALEDATA</span></a> | <a class="reference internal" href="#daqhats_8h_1af25a40101f44bd0ea3a5e77d525832e0"><span class="std std-ref">OPTS_NOCALIBRATEDATA</span></a> will return the values read from the ADC without calibration or converting to voltage.</p>
<p>The buffer size will be allocated as follows:</p>
<p><strong>Finite</strong> mode: Total number of samples in the scan</p>
<p><strong>Continuous</strong> mode (buffer size is per channel): Either <strong>samples_per_channel</strong> or the value in the following table, whichever is greater</p>
<p><table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Sample Rate   </p></th>
<th class="head"><p>Buffer Size (per channel)    </p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>200-1024 S/s   </p></td>
<td><p>1 kS    </p></td>
</tr>
<tr class="row-odd"><td><p>1280-10.24 kS/s   </p></td>
<td><p>10 kS    </p></td>
</tr>
<tr class="row-even"><td><p>12.8, 25.6, 51.2 kS/s   </p></td>
<td><p>100 kS   </p></td>
</tr>
</tbody>
</table>
</p>
<p>Specifying a very large value for <strong>samples_per_channel</strong> could use too much of the Raspberry Pi memory. If the memory allocation fails, the function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a>. The allocation could succeed, but the lack of free memory could cause other problems in the Raspberry Pi. If you need to acquire a high number of samples then it is better to run the scan in continuous mode and stop it when you have acquired the desired amount of data. If a scan is already active this function will return <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>channel_mask</strong> – A bit mask of the channels to be scanned. Set each bit to enable the associated channel (0x01 - 0x03.) </p></li>
<li><p><strong>samples_per_channel</strong> – The number of samples to acquire for each channel in the scan (finite mode,) or can be used to set a larger scan buffer size than the default value (continuous mode.) </p></li>
<li><p><strong>options</strong> – The options bitmask. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a67cf6a7b807c20e18dc78ab964b04911"><span class="std std-ref">RESULT_BUSY</span></a> if a scan is already active. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_buffer_size">
<span class="target" id="mcc172_8h_1a4478a605e03b23bb0764d877f7e40017"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_buffer_size</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer_size_samples</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_buffer_size" title="Link to this definition"></a><br /></dt>
<dd><p>Returns the size of the internal scan data buffer. </p>
<p>An internal data buffer is allocated for the scan when <a class="reference internal" href="#mcc172_8h_1aef1b8c4747b1c53413ab993db9ca85b5"><span class="std std-ref">mcc172_a_in_scan_start()</span></a> is called. This function returns the total size of that buffer in samples.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>buffer_size_samples</strong> – Receives the size of the buffer in samples. Each sample is a <strong>double</strong>. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan is not currently active, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a140e9ae03c9465d0a1881b9dff30518a"><span class="std std-ref">RESULT_BAD_PARAMETER</span></a> if the address is invalid or buffer_size_samples is NULL. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_status">
<span class="target" id="mcc172_8h_1a2a4fccc974d67585bd31dddd57108803"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_status</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">status</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">samples_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_status" title="Link to this definition"></a><br /></dt>
<dd><p>Reads status and number of available samples from an analog input scan. </p>
<p>The scan is started with <a class="reference internal" href="#mcc172_8h_1aef1b8c4747b1c53413ab993db9ca85b5"><span class="std std-ref">mcc172_a_in_scan_start()</span></a> and runs in a background thread that reads the data from the board into an internal scan buffer. This function reads the status of the scan and amount of data in the scan buffer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>status</strong> – Receives the scan status, an ORed combination of the flags:<ul>
<li><p><a class="reference internal" href="#daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"><span class="std std-ref">STATUS_HW_OVERRUN</span></a>: The device scan buffer was not read fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"><span class="std std-ref">STATUS_BUFFER_OVERRUN</span></a>: The thread scan buffer was not read by the user fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"><span class="std std-ref">STATUS_TRIGGERED</span></a>: The trigger conditions have been met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"><span class="std std-ref">STATUS_RUNNING</span></a>: The scan is running. </p></li>
</ul>
</p></li>
<li><p><strong>samples_per_channel</strong> – Receives the number of samples per channel available in the scan thread buffer. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan has not been started under this instance of the device. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_read">
<span class="target" id="mcc172_8h_1a99e9ef7bac1b4a3b48f0510cf1ef704f"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_read</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">status</span></span>, <span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="n"><span class="pre">samples_per_channel</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="n"><span class="pre">timeout</span></span>, <span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">buffer</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n"><span class="pre">buffer_size_samples</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">samples_read_per_channel</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_read" title="Link to this definition"></a><br /></dt>
<dd><p>Reads status and multiple samples from an analog input scan. </p>
<p>The scan is started with <a class="reference internal" href="#mcc172_8h_1aef1b8c4747b1c53413ab993db9ca85b5"><span class="std std-ref">mcc172_a_in_scan_start()</span></a> and runs in a background thread that reads the data from the board into an internal scan buffer. This function reads the data from the scan buffer, and returns the current scan status.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
<li><p><strong>status</strong> – Receives the scan status, an ORed combination of the flags:<ul>
<li><p><a class="reference internal" href="#daqhats_8h_1a89fa865687f9600cea9b639b7e9a507c"><span class="std std-ref">STATUS_HW_OVERRUN</span></a>: The device scan buffer was not read fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a25928537fb73983bca9c65d869e2cdaf"><span class="std std-ref">STATUS_BUFFER_OVERRUN</span></a>: The thread scan buffer was not read by the user fast enough and data was lost.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a48966b880c7694b5ff8828b02e3b4eb9"><span class="std std-ref">STATUS_TRIGGERED</span></a>: The trigger conditions have been met.</p></li>
<li><p><a class="reference internal" href="#daqhats_8h_1a799b04d03f49612e3e636b56c3972b80"><span class="std std-ref">STATUS_RUNNING</span></a>: The scan is running. </p></li>
</ul>
</p></li>
<li><p><strong>samples_per_channel</strong> – The number of samples per channel to read. Specify <strong>-1</strong> to read all available samples in the scan thread buffer, ignoring <strong>timeout</strong>. If <strong>buffer</strong> does not contain enough space then the function will read as many samples per channel as will fit in <strong>buffer</strong>. </p></li>
<li><p><strong>timeout</strong> – The amount of time in seconds to wait for the samples to be read. Specify a negative number to wait indefinitely or <strong>0</strong> to return immediately with whatever samples are available (up to the value of <strong>samples_per_channel</strong> or <strong>buffer_size_samples</strong>.) </p></li>
<li><p><strong>buffer</strong> – The user data buffer that receives the samples. </p></li>
<li><p><strong>buffer_size_samples</strong> – The size of the buffer in samples. Each sample is a <strong>double</strong>. </p></li>
<li><p><strong>samples_read_per_channel</strong> – Returns the actual number of samples read from each channel. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4a64760672ed06a947256c161076afac6a"><span class="std std-ref">RESULT_RESOURCE_UNAVAIL</span></a> if a scan is not active. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_channel_count">
<span class="target" id="mcc172_8h_1ad174442f9b949ac295b4e4d5db054c57"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_channel_count</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_channel_count" title="Link to this definition"></a><br /></dt>
<dd><p>Return the number of channels in the current analog input scan. </p>
<p>This function returns 0 if no scan is active.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The number of channels, 0 - 2. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_stop">
<span class="target" id="mcc172_8h_1a91b01737a38dfc59846414392f09352f"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_stop</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_stop" title="Link to this definition"></a><br /></dt>
<dd><p>Stops an analog input scan. </p>
<p>The scan is stopped immediately. The scan data that has been read into the scan buffer is available until <a class="reference internal" href="#mcc172_8h_1a3c623caa4d914138eb3b8def0ecece2d"><span class="std std-ref">mcc172_a_in_scan_cleanup()</span></a> is called.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt class="sig sig-object c" id="c.mcc172_a_in_scan_cleanup">
<span class="target" id="mcc172_8h_1a3c623caa4d914138eb3b8def0ecece2d"></span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mcc172_a_in_scan_cleanup</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n"><span class="pre">address</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.mcc172_a_in_scan_cleanup" title="Link to this definition"></a><br /></dt>
<dd><p>Free analog input scan resources after the scan is complete. </p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>address</strong> – The board address (0 - 7). Board must already be opened. </p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4"><span class="std std-ref">Result code</span></a>, <a class="reference internal" href="#daqhats_8h_1ad8097859ab1bdd06be52a8421df152d4af3d0d72febdcc6491554576ed31f686e"><span class="std std-ref">RESULT_SUCCESS</span></a> if successful. </p>
</dd>
</dl>
</dd></dl>

</section>
<section id="id12">
<h3>Data definitions<a class="headerlink" href="#id12" title="Link to this heading"></a></h3>
<section id="id13">
<h4>Device Info<a class="headerlink" href="#id13" title="Link to this heading"></a></h4>
<dl class="c struct">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo">
<span class="target" id="structMCC172DeviceInfo"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MCC172DeviceInfo</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo" title="Link to this definition"></a><br /></dt>
<dd><p>MCC 172 constant device information. </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.NUM_AI_CHANNELS">
<span class="target" id="structMCC172DeviceInfo_1a7cfc29380efcecdf3568a2019c1f459a"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">NUM_AI_CHANNELS</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.NUM_AI_CHANNELS" title="Link to this definition"></a><br /></dt>
<dd><p>The number of analog input channels (2.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.AI_MIN_CODE">
<span class="target" id="structMCC172DeviceInfo_1ada0fdef91506d687e4baadd3b78f5618"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_CODE</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.AI_MIN_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum ADC code (-8,388,608.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.AI_MAX_CODE">
<span class="target" id="structMCC172DeviceInfo_1ae5774e21848d501fe8f5eb674bf14cac"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="n"><span class="pre">int32_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_CODE</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.AI_MAX_CODE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum ADC code (8,388,607.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.AI_MIN_VOLTAGE">
<span class="target" id="structMCC172DeviceInfo_1adfa884ba2c03b0209eae12dff634c50a"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.AI_MIN_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the minimum code (-5.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.AI_MAX_VOLTAGE">
<span class="target" id="structMCC172DeviceInfo_1ace4fee94a99ddab4caf8ce30d2d777c3"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_VOLTAGE</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.AI_MAX_VOLTAGE" title="Link to this definition"></a><br /></dt>
<dd><p>The input voltage corresponding to the maximum code (+5.0V - 1 LSB.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.AI_MIN_RANGE">
<span class="target" id="structMCC172DeviceInfo_1a93d93550ec0e275a12b67ec4b8ec2971"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MIN_RANGE</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.AI_MIN_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The minimum voltage of the input range (-5.0V.) </p>
</dd></dl>

<dl class="c var">
<dt class="sig sig-object c" id="c.MCC172DeviceInfo.AI_MAX_RANGE">
<span class="target" id="structMCC172DeviceInfo_1a14afe15506c8df7110c7c2ba2b74a37a"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">double</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">AI_MAX_RANGE</span></span></span><a class="headerlink" href="#c.MCC172DeviceInfo.AI_MAX_RANGE" title="Link to this definition"></a><br /></dt>
<dd><p>The maximum voltage of the input range (+5.0V.) </p>
</dd></dl>

</div>
</dd></dl>

</section>
<section id="source-types">
<h4>Source Types<a class="headerlink" href="#source-types" title="Link to this heading"></a></h4>
<dl class="c enum">
<dt class="sig sig-object c" id="c.SourceType">
<span class="target" id="mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">SourceType</span></span></span><a class="headerlink" href="#c.SourceType" title="Link to this definition"></a><br /></dt>
<dd><p>Clock / trigger source definitions. </p>
<p><em>Values:</em></p>
<dl class="c enumerator">
<dt class="sig sig-object c" id="c.SourceType.SOURCE_LOCAL">
<span class="target" id="mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1af3e14d0513d3544e7a53e6b391b591d1"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">SOURCE_LOCAL</span></span></span><a class="headerlink" href="#c.SourceType.SOURCE_LOCAL" title="Link to this definition"></a><br /></dt>
<dd><p>Use a local-only source. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.SourceType.SOURCE_MASTER">
<span class="target" id="mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a09141537ae750f5a10118f36b95b6633"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">SOURCE_MASTER</span></span></span><a class="headerlink" href="#c.SourceType.SOURCE_MASTER" title="Link to this definition"></a><br /></dt>
<dd><p>Use a local source and set it as master. </p>
</dd></dl>

<dl class="c enumerator">
<dt class="sig sig-object c" id="c.SourceType.SOURCE_SLAVE">
<span class="target" id="mcc172_8h_1a3ae727773c367ac1041d72ac770a0ab1a6bbbe701eb16b191dfb6e3b3c42c7f9e"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">SOURCE_SLAVE</span></span></span><a class="headerlink" href="#c.SourceType.SOURCE_SLAVE" title="Link to this definition"></a><br /></dt>
<dd><p>Use a separate master source. </p>
</dd></dl>

</dd></dl>

</section>
</section>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="install.html" class="btn btn-neutral float-left" title="Installing and Using the Library" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="python.html" class="btn btn-neutral float-right" title="Python Library Reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2020, Measurement Computing.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>